added /debug Save for quickly saving any data
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
### High priority:
|
||||
- Update LANG system to be more organized
|
||||
- Add a lot more logging
|
||||
|
||||
<!--
|
||||
- [ ] Reddit bot that scrapes images with tag "Original Art" and posts them in Discord server
|
||||
- [ ] handle dm_on_error cfg
|
||||
- [ ] Allow updating the data autonomously and via manual commands.
|
||||
- [ ] 10-minute schedule for updating Discord channel (IMPOSSIBLE / REALLY FUCKING HARD)
|
||||
-->
|
||||
|
||||
### Medium priority:
|
||||
- [ ] Postfix calculator
|
||||
- [ ] Postfix generator
|
||||
- [ ] Random tip (from ByteDice.net/data/loadingScreenTips.json)
|
||||
- [ ] A command that just sends my socials
|
||||
|
||||
### Low priority:
|
||||
<!--
|
||||
- [ ] Content update sender
|
||||
* Automatically sends sneak peeks (like commit history or manual) of projects when they're updated
|
||||
-->
|
||||
|
||||
+2
-1
@@ -21,8 +21,9 @@
|
||||
"dc_msg_mandatory_response": "Mandatory response message, please ignore.",
|
||||
"dc_msg_no_perms": "Missing permission in that server: {0}",
|
||||
"dc_msg_not_in_guild": "I am not a part of that guild.",
|
||||
"dc_msg_owner_data_save_complete": "Saving data... Done!\nShutting down...",
|
||||
"dc_msg_owner_data_save_complete": "Saving data... Done!",
|
||||
"dc_msg_owner_data_save": "Saving data...",
|
||||
"dc_msg_owner_shutdown": "Shutting down...",
|
||||
"dc_msg_owner_shutdown_failed_confirmation": "Failed to shut down: Invalid confirmation.",
|
||||
"dc_msg_re_already_voted": "Couldn't cast a vote: You have already voted on this post!",
|
||||
"dc_msg_re_also_approved": "Also approved it!",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{Context, Error, debug_cmds::{guild_invite, leave_guild, ping, stop, view_guilds, whoami}};
|
||||
use crate::{Context, Error, debug_cmds::{guild_invite, leave_guild, ping, save, stop, view_guilds, whoami}};
|
||||
|
||||
|
||||
#[derive(poise::ChoiceParameter, PartialEq)]
|
||||
@@ -7,6 +7,7 @@ pub enum Subcommands {
|
||||
LeaveGuild,
|
||||
Ping,
|
||||
//ReloadCfg,
|
||||
Save,
|
||||
Stop,
|
||||
ViewGuilds,
|
||||
WhoAmI
|
||||
@@ -36,6 +37,7 @@ pub async fn cmd(
|
||||
Subcommands::LeaveGuild => leave_guild::cmd(ctx, u64_arg_u).await?,
|
||||
Subcommands::Ping => ping::cmd(ctx).await?,
|
||||
//Subcommands::ReloadCfg => reload_cfg::cmd(ctx).await?,
|
||||
Subcommands::Save => save::cmd(ctx).await?,
|
||||
Subcommands::Stop => stop::cmd(ctx, string_arg).await?,
|
||||
Subcommands::ViewGuilds => view_guilds::cmd(ctx).await?,
|
||||
Subcommands::WhoAmI => whoami::cmd(ctx).await?,
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
use crate::{Context, Error, data, lang, messages::{edit_reply, send_msg}};
|
||||
|
||||
pub async fn cmd(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let msg = send_msg(ctx, lang!("dc_msg_owner_data_save"), true, true).await.unwrap();
|
||||
|
||||
data::write_dc_data(ctx.data()).await;
|
||||
data::write_re_data().await;
|
||||
|
||||
edit_reply(ctx, msg, lang!("dc_msg_owner_data_save_complete")).await;
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@@ -4,7 +4,7 @@ use poise::serenity_prelude::OnlineStatus;
|
||||
|
||||
use crate::{data, lang, messages::{edit_reply, send_msg}, websocket::send_cmd_json, Context, Error};
|
||||
|
||||
pub async fn cmd(ctx: Context<'_>, confirmation: Option<String>) -> Result<(), Error>{
|
||||
pub async fn cmd(ctx: Context<'_>, confirmation: Option<String>) -> Result<(), Error> {
|
||||
let stop_confirm = "i want to stop the bot now".replace(" ", "");
|
||||
let confirm_formatted = confirmation.unwrap_or_default().to_lowercase().replace(" ", "");
|
||||
let should_stop = ctx.data().args.dev || confirm_formatted == stop_confirm;
|
||||
@@ -15,7 +15,13 @@ pub async fn cmd(ctx: Context<'_>, confirmation: Option<String>) -> Result<(), E
|
||||
data::write_re_data().await;
|
||||
send_cmd_json("stop_praw", None, true).await;
|
||||
|
||||
edit_reply(ctx, msg, lang!("dc_msg_owner_data_save_complete")).await;
|
||||
let complete = format!(
|
||||
"{}\n{}",
|
||||
lang!("dc_msg_owner_data_save_complete"),
|
||||
lang!("dc_msg_owner_shutdown")
|
||||
);
|
||||
|
||||
edit_reply(ctx, msg, complete).await;
|
||||
ctx.serenity_context().set_presence(None, OnlineStatus::Invisible);
|
||||
ctx.framework().shard_manager.shutdown_all().await;
|
||||
|
||||
|
||||
+2
-1
@@ -24,9 +24,10 @@ mod debug_cmds {
|
||||
pub mod guild_invite;
|
||||
pub mod leave_guild;
|
||||
pub mod main_cmd;
|
||||
pub mod stop;
|
||||
pub mod ping;
|
||||
pub mod reload_cfg;
|
||||
pub mod save;
|
||||
pub mod stop;
|
||||
pub mod view_guilds;
|
||||
pub mod whoami;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user