diff --git a/src/commands/test.rs b/src/commands/test.rs index 2165569..efa02a8 100644 --- a/src/commands/test.rs +++ b/src/commands/test.rs @@ -5,7 +5,7 @@ use serenity::model::channel::Message; use serenity::prelude::*; use serenity::model::prelude::*; -use super::super::utils; +use crate::utils; pub async fn parse_command(ctx: Context, msg: Message, server_id: GuildId) diff --git a/src/main.rs b/src/main.rs index 027284a..f12fef4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,14 @@ mod commands; mod data_loader; mod utils; +use std::collections::HashSet; + use serenity::async_trait; +use serenity::prelude::*; +use serenity::model::prelude::*; use serenity::model::channel::Message; use serenity::model::gateway::Ready; -use serenity::prelude::*; -// use serenity::model::prelude::*; +use serenity::http::Http; struct Handler; @@ -46,6 +49,16 @@ async fn main() Err(why) => panic!("Could not load app token: {}", why), }; + // Fetch the application owner id + let http = Http::new(&token); + let owner = match http.get_current_application_info().await + { + Ok(info) => info.owner.id, + Err(why) => panic!("Could not access application info: {:?}", why), + }; + + + println!("Connecting..."); let intents = GatewayIntents::GUILD_MESSAGES @@ -57,6 +70,10 @@ async fn main() // by Discord for bot users. let mut client = Client::builder(&token, intents).event_handler(Handler).await.expect("Err creating client"); + // TODO: See link for how to add global data to the client: + // https://github.com/serenity-rs/serenity/blob/current/examples/e12_global_data/src/main.rs + // client.data.write().await.insert::(owner); + // Finally, start a single shard, and start listening to events. // // Shards will automatically attempt to reconnect, and will perform