re-categorized commands & removed reload_config because its too much work

This commit is contained in:
2026-02-25 14:53:30 +01:00
parent bb06048b0b
commit e88033fbea
7 changed files with 62 additions and 49 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
use crate::{Context, Error, debug_cmds::{guild_invite, leave_guild, ping, reload_cfg, stop, view_guilds, whoami}};
use crate::{Context, Error, debug_cmds::{guild_invite, leave_guild, ping, stop, view_guilds, whoami}};
#[derive(poise::ChoiceParameter, PartialEq)]
@@ -6,7 +6,7 @@ pub enum Subcommands {
GuildInvite,
LeaveGuild,
Ping,
ReloadCfg,
//ReloadCfg,
Stop,
ViewGuilds,
WhoAmI
@@ -35,7 +35,7 @@ pub async fn cmd(
Subcommands::GuildInvite => guild_invite::cmd(ctx, u64_arg_u).await?,
Subcommands::LeaveGuild => leave_guild::cmd(ctx, u64_arg_u).await?,
Subcommands::Ping => ping::cmd(ctx).await?,
Subcommands::ReloadCfg => reload_cfg::cmd(ctx).await?,
//Subcommands::ReloadCfg => reload_cfg::cmd(ctx).await?,
Subcommands::Stop => stop::cmd(ctx, string_arg).await?,
Subcommands::ViewGuilds => view_guilds::cmd(ctx).await?,
Subcommands::WhoAmI => whoami::cmd(ctx).await?,
+12 -5
View File
@@ -1,4 +1,4 @@
use crate::{data::{self, get_toml_mutex, read_cfg_data}, lang, messages::send_msg, Context, Error};
/*use crate::{Context, Error, data::{self, get_toml_mutex, read_cfg_data}, lang, messages::send_msg};
pub async fn cmd(ctx: Context<'_>) -> Result<(), Error> {
@@ -7,9 +7,7 @@ pub async fn cmd(ctx: Context<'_>) -> Result<(), Error> {
if r.is_none() { return Ok(()); }
let data_binding = get_toml_mutex(&ctx.data().cfg).await.unwrap();
let lang_cfg = data_binding["general"]["lang"].as_str().unwrap();
data::load_lang_data(lang_cfg.to_string());
update_cfg(ctx).await;
if r.unwrap()["value"].as_bool().unwrap() {
send_msg(
@@ -23,4 +21,13 @@ pub async fn cmd(ctx: Context<'_>) -> Result<(), Error> {
send_msg(ctx, lang!("dc_msg_reload_cfg_python_fail"), true, true).await;
return Ok(());
}
}
async fn update_cfg(ctx: Context<'_>) {
let data_binding = get_toml_mutex(&ctx.data().cfg).await.unwrap();
let lang_cfg = data_binding["general"]["lang"].as_str().unwrap();
data::load_lang_data(lang_cfg.to_string());
set_status(data_binding, ctx).await;
}*/