From a4da7263c5860cfb8097e3ab2ad76a336a7679c3 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 11 Aug 2026 14:28:54 -0400 Subject: [PATCH] mod: remove guild identifier limitation --- README.md | 1 - docker-compose.yml | 1 - src/discord.rs | 29 ++++++++++------------------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 8014f0d..7734b20 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ If you are running `nix` or NixOS, you should probably run the provided `flake.n Running the binary by itself won't do anything. In fact, the bot will just quit if you don't have the needed information. You will need to have the following: - A Discord token - `DISCORD_TOKEN` -- A guild ID - `GUILD_ID` _OR_ diff --git a/docker-compose.yml b/docker-compose.yml index cd48e11..663b8c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,6 @@ services: LETSENCRYPT_HOST: LETSENCRYPT_EMAIL: ## Fill these in when you deploy - # GUILD_ID: # DISCORD_TOKEN: # # OR FILL THESE IN INSTEAD diff --git a/src/discord.rs b/src/discord.rs index b98d7a0..734432d 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -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()),