This commit is contained in:
+10
-19
@@ -2,9 +2,8 @@ use std::env;
|
||||
|
||||
use serenity::async_trait;
|
||||
use serenity::builder::{CreateInteractionResponse, CreateInteractionResponseMessage};
|
||||
use serenity::model::application::Interaction;
|
||||
use serenity::model::application::{Command, Interaction};
|
||||
use serenity::model::gateway::Ready;
|
||||
use serenity::model::id::GuildId;
|
||||
use serenity::prelude::*;
|
||||
|
||||
use crate::commands;
|
||||
@@ -35,23 +34,15 @@ impl EventHandler for Handler {
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
println!("{} is connected!", ready.user.name);
|
||||
|
||||
let guild_id = GuildId::new(
|
||||
env::var("GUILD_ID")
|
||||
.expect("Expected GUILD_ID in environment")
|
||||
.parse()
|
||||
.expect("GUILD_ID must be an integer"),
|
||||
);
|
||||
|
||||
let cmds = guild_id
|
||||
.set_commands(
|
||||
&ctx.http,
|
||||
vec![
|
||||
commands::roll::register(),
|
||||
commands::random::register(),
|
||||
commands::about::register(),
|
||||
],
|
||||
)
|
||||
.await;
|
||||
let cmds = Command::set_global_commands(
|
||||
&ctx.http,
|
||||
vec![
|
||||
commands::roll::register(),
|
||||
commands::random::register(),
|
||||
commands::about::register(),
|
||||
],
|
||||
)
|
||||
.await;
|
||||
|
||||
match cmds {
|
||||
Ok(c) => println!("Registered {} commands!", c.len()),
|
||||
|
||||
Reference in New Issue
Block a user