feat: new command to count the server info, available on the computer soc server

This commit is contained in:
silver 2025-02-27 23:56:48 +00:00
parent 934842cbc9
commit 7d7afcd00c
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
5 changed files with 180 additions and 86 deletions

View file

@ -1,7 +1,7 @@
pub mod commands;
use crate::commands::role_adder::tools::on_role_change;
use serenity::all::{ActivityData, Command, CreateMessage, EditInteractionResponse, GuildMemberUpdateEvent, Interaction};
use serenity::all::{ActivityData, Command, CreateMessage, EditInteractionResponse, GuildId, GuildMemberUpdateEvent, Interaction};
use serenity::model::guild::Member;
use serenity::{
async_trait,
@ -139,7 +139,17 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
match &config_global
.committee_server
.set_commands(&ctx.http, vec![commands::committee::count::register()])
.set_commands(&ctx.http, vec![commands::count::committee::register()])
.await
{
Ok(_) => {}
Err(e) => {
println!("{:?}", e)
}
}
match GuildId::new(689189992417067052)
.set_commands(&ctx.http, vec![commands::count::servers::register()])
.await
{
Ok(_) => {}
@ -165,8 +175,16 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
"minecraft_add" => commands::minecraft::server::add::run(&command, &ctx).await,
"minecraft_list" => commands::minecraft::server::list::run(&command, &ctx).await,
"minecraft_delete" => commands::minecraft::server::delete::run(&command, &ctx).await,
"committee" => commands::committee::count::run(&command, &ctx).await,
_ => "not implemented :(".to_string(),
// sub command
"count" => match command.data.options.first() {
None => "Invalid Command".to_string(),
Some(x) => match x.name.as_str() {
"committee" => commands::count::committee::run(&command, &ctx).await,
"servers" => commands::count::servers::run(&command, &ctx).await,
&_ => format!("not implemented :( count {}", x.name.as_str()),
},
},
_ => format!("not implemented :( {}", command.data.name.as_str()),
};
if let Err(why) = command.edit_response(&ctx.http, EditInteractionResponse::new().content(content)).await {