diff --git a/Module/ModTools/CommandBase.cs b/Module/ModTools/CommandBase.cs index 5f98a75..7cf247c 100644 --- a/Module/ModTools/CommandBase.cs +++ b/Module/ModTools/CommandBase.cs @@ -47,6 +47,7 @@ namespace Noikoio.RegexBot.Module.ModTools { // Define all command types and their corresponding Types here { "ban", typeof(Commands.Ban) }, + { "confreload", typeof(Commands.ConfReload) }, { "kick", typeof(Commands.Kick) }, { "say", typeof(Commands.Say) }, { "unban", typeof(Commands.Unban) } diff --git a/Module/ModTools/Commands/ConfReload.cs b/Module/ModTools/Commands/ConfReload.cs new file mode 100644 index 0000000..d8da69e --- /dev/null +++ b/Module/ModTools/Commands/ConfReload.cs @@ -0,0 +1,25 @@ +using Discord.WebSocket; +using Newtonsoft.Json.Linq; +using System.Threading.Tasks; + +namespace Noikoio.RegexBot.Module.ModTools.Commands +{ + class ConfReload : CommandBase + { + // No configuration. + protected ConfReload(ModTools l, string label, JObject conf) : base(l, label, conf) { } + + // Usage: (command) + public override async Task Invoke(SocketGuild g, SocketMessage msg) + { + bool status = await RegexBot.Config.ReloadServerConfig(); + string res; + if (status) res = ":white_check_mark: Configuration reloaded with no issues. Check the console to verify."; + else res = ":x: Reload failed. Check the console."; + await msg.Channel.SendMessageAsync(res); + } + + // Crazy idea: somehow redirect all logging messages created from invoking config reloading + // and pass them onto the invoking channel. + } +}