echbot/src/main.rs

41 lines
1.4 KiB
Rust
Raw Normal View History

2023-01-09 18:38:08 -05:00
use poise::serenity_prelude as serenity;
mod commands;
2023-01-09 18:38:08 -05:00
struct Data {}
type Error = Box<dyn std::error::Error + Send + Sync>;
type Context<'a> = poise::Context<'a, Data, Error>;
#[tokio::main]
async fn main() {
let framework = poise::Framework::builder()
.options(poise::FrameworkOptions {
2023-01-21 19:49:39 -05:00
commands: vec![commands::slur::slur(), commands::team::team()], // IntelliJ doesn't like this, but it's fine.
2023-01-09 18:38:08 -05:00
..Default::default()
})
2023-01-21 19:49:39 -05:00
.token(std::env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN"))
2023-01-11 16:31:15 -05:00
.intents(serenity::GatewayIntents::non_privileged()) // Set intents for Discord dev portal
2023-01-09 18:38:08 -05:00
.setup(|ctx, _ready, framework| {
Box::pin(async move {
2023-01-11 16:31:15 -05:00
poise::builtins::register_in_guild(
ctx,
&framework.options().commands,
2023-01-21 19:49:39 -05:00
serenity::GuildId(
std::env::var("GUILD_ID")
.expect("Missing GUILD_ID") // Get GID from env and parse
.parse::<u64>()
.unwrap(),
),
)
.await?; // Update slash commands in GID
ctx.set_activity(serenity::Activity::playing("SMITE")).await;
2023-01-09 18:38:08 -05:00
Ok(Data {})
})
});
framework.run().await.unwrap();
2023-01-09 18:41:05 -05:00
}