/* TODO: Use tracing for better debugging following events */ use std::env; use serenity::framework::standard::StandardFramework; use serenity::prelude::*; // This trait adds the `register_songbird` and `register_songbird_with` methods // to the client builder below, making it easy to install this voice client. // The voice client can be retrieved in any command using `songbird::get(ctx).await`. use songbird::SerenityInit; mod commands; use commands::*; mod events; use events::*; mod utils; #[tokio::main] async fn main() { // Trace async functions tracing_subscriber::fmt::init(); // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment"); // Set gateway intents, which decides what events the bot will be notified about let intents = GatewayIntents::GUILDS | GatewayIntents::DIRECT_MESSAGES | GatewayIntents::DIRECT_MESSAGE_REACTIONS | GatewayIntents::DIRECT_MESSAGE_TYPING | GatewayIntents::MESSAGE_CONTENT | GatewayIntents::GUILD_VOICE_STATES; let framework = StandardFramework::new() .configure(|c| c.prefix("ALAN! ")) .group(&GENERAL_GROUP); let mut client = Client::builder(&token, intents) .event_handler(Handler) .framework(framework) .register_songbird() .await .expect("Err creating client"); // TODO: do checks when getting data in add guild etc. println!("Initialize guild voice popin state"); utils::guild_popin::init(client); if let Err(why) = client.start().await { println!("Client error: {:?}", why); } }