feat: bumped serenity to the latest version

Lots of changes to how it runs
This commit is contained in:
silver 2025-02-19 00:17:02 +00:00
parent a8c1cc9cf1
commit 6b84f33d2e
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
12 changed files with 352 additions and 485 deletions

View file

@ -3,9 +3,9 @@ pub mod common;
use chrono::{Datelike, SecondsFormat, Utc};
use dotenvy::dotenv;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use serenity::all::CommandInteraction;
use serenity::client::Context;
use serenity::model::id::{ChannelId, GuildId, RoleId};
use serenity::model::prelude::application_command::ApplicationCommandInteraction;
use serenity::prelude::TypeMapKey;
use std::{env, sync::Arc};
use tokio::sync::RwLock;
@ -57,9 +57,9 @@ pub fn get_config() -> Config {
mail_pass: "".to_string(),
wolves_url: "".to_string(),
wolves_api: "".to_string(),
committee_server: GuildId(0),
committee_role: RoleId(0),
committee_category: ChannelId(0),
committee_server: GuildId::new(0),
committee_role: RoleId::new(0),
committee_category: ChannelId::new(0),
};
if let Ok(x) = env::var("DATABASE_HOME") {
@ -98,17 +98,17 @@ pub fn get_config() -> Config {
if let Ok(x) = env::var("COMMITTEE_DISCORD") {
if let Ok(x) = x.trim().parse::<u64>() {
config.committee_server = GuildId(x);
config.committee_server = GuildId::new(x);
}
}
if let Ok(x) = env::var("COMMITTEE_DISCORD") {
if let Ok(x) = x.trim().parse::<u64>() {
config.committee_role = RoleId(x);
config.committee_role = RoleId::new(x);
}
}
if let Ok(x) = env::var("COMMITTEE_CATEGORY") {
if let Ok(x) = x.trim().parse::<u64>() {
config.committee_category = ChannelId(x);
config.committee_category = ChannelId::new(x);
}
}
@ -131,7 +131,7 @@ pub fn random_string(len: usize) -> String {
/**
For any time ye need to check if a user who calls a command has admin privlages
*/
pub async fn is_admin(command: &ApplicationCommandInteraction, ctx: &Context) -> Option<String> {
pub async fn is_admin(command: &CommandInteraction, ctx: &Context) -> Option<String> {
let mut admin = false;
let g_id = match command.guild_id {