diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/copypasta.rs | 2 | ||||
| -rw-r--r-- | src/main.rs | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/commands/copypasta.rs b/src/commands/copypasta.rs index d7ec2d0..20ca144 100644 --- a/src/commands/copypasta.rs +++ b/src/commands/copypasta.rs @@ -28,7 +28,7 @@ pub async fn run(options: &[CommandDataOption], channel_id: ChannelId, http: &Ar Ok(_) => continue, Err(why) => { println!("couldn't send message: {:?}", why); - "something went wrong!"; + return "something went wrong!".to_string(); } } } diff --git a/src/main.rs b/src/main.rs index 01b3fb2..22a71db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use regex::Regex; use serenity::async_trait; use serenity::framework::standard::macros::{command, group}; use serenity::framework::standard::{CommandResult, StandardFramework}; +use serenity::model::application::command::Command; use serenity::model::application::interaction::{Interaction, InteractionResponseType}; use serenity::model::channel::Message; use serenity::model::id::GuildId; @@ -15,7 +16,7 @@ mod commands; mod consts; mod utils; -const GUILD: u64 = 1055663552679137310; +const TEAWIE_GUILD: u64 = 1055663552679137310; const BOT: u64 = 1056467120986271764; #[group] @@ -96,19 +97,25 @@ impl EventHandler for Handler { async fn ready(&self, ctx: Context, ready: Ready) { println!("connected as {:?}", ready.user.name); - let guild_id = GuildId(GUILD); + let guild_id = GuildId(TEAWIE_GUILD); - let commands = GuildId::set_application_commands(&guild_id, &ctx.http, |commands| { + let guild_commands = GuildId::set_application_commands(&guild_id, &ctx.http, |commands| { + commands.create_application_command(|command| commands::copypasta::register(command)) + }) + .await; + + println!("registered guild commands: {:#?}", guild_commands); + + let commands = Command::set_global_application_commands(&ctx.http, |commands| { commands .create_application_command(|command| commands::ask::register(command)) .create_application_command(|command| commands::bottom::register(command)) - .create_application_command(|command| commands::copypasta::register(command)) .create_application_command(|command| commands::random_lore::register(command)) .create_application_command(|command| commands::random_teawie::register(command)) }) .await; - println!("registered commands: {:#?}", commands); + println!("registered global commands: {:#?}", commands); } } |
