Created
March 7, 2023 13:39
-
-
Save barrybtw/e5a1c34340c38d8d1d8718529e5cb256 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "one1" | |
| version = "0.1.0" | |
| edition = "2021" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [dependencies] | |
| dotenv = "0.15.0" | |
| serenity = "0.11.5" | |
| tokio = {version = "1.26.0", features = ["full"]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # fly.toml file generated for one1 on 2023-03-07T14:17:44+01:00 | |
| app = "one1" | |
| kill_signal = "SIGINT" | |
| kill_timeout = 5 | |
| processes = [] | |
| [env] | |
| [experimental] | |
| auto_rollback = true | |
| [[services]] | |
| http_checks = [] | |
| internal_port = 8080 | |
| processes = ["app"] | |
| protocol = "tcp" | |
| script_checks = [] | |
| [services.concurrency] | |
| hard_limit = 25 | |
| soft_limit = 20 | |
| type = "connections" | |
| [[services.ports]] | |
| force_https = true | |
| handlers = ["http"] | |
| port = 80 | |
| [[services.ports]] | |
| handlers = ["tls", "http"] | |
| port = 443 | |
| [[services.tcp_checks]] | |
| grace_period = "1s" | |
| interval = "15s" | |
| restart_limit = 0 | |
| timeout = "2s" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use dotenv::dotenv; | |
| use std::env; | |
| use serenity::async_trait; | |
| use serenity::framework::standard::macros::{command, group}; | |
| use serenity::framework::standard::{CommandResult, StandardFramework}; | |
| use serenity::model::channel::Message; | |
| use serenity::prelude::*; | |
| #[group] | |
| #[commands(ping)] | |
| struct General; | |
| struct Handler; | |
| #[async_trait] | |
| impl EventHandler for Handler {} | |
| #[tokio::main] | |
| async fn main() { | |
| dotenv().ok(); | |
| let framework = StandardFramework::new() | |
| .configure(|c| c.prefix("!")) | |
| .group(&GENERAL_GROUP); | |
| // Login with a bot token from the environment | |
| let token = env::var("DISCORD_TOKEN").expect("token"); | |
| let intents = GatewayIntents::non_privileged() | GatewayIntents::MESSAGE_CONTENT; | |
| let mut client = Client::builder(token, intents) | |
| .event_handler(Handler) | |
| .framework(framework) | |
| .await | |
| .expect("Error creating client"); | |
| // start listening for events by starting a single shard | |
| if let Err(why) = client.start().await { | |
| println!("An error occurred while running the client: {:?}", why); | |
| } | |
| } | |
| #[command] | |
| async fn ping(ctx: &Context, msg: &Message) -> CommandResult { | |
| msg.reply(ctx, "Pong!").await?; | |
| Ok(()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment