Added 'ConfReload' command type
This commit is contained in:
parent
dc7725c7b0
commit
7a8a82102f
2 changed files with 26 additions and 0 deletions
|
@ -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) }
|
||||
|
|
25
Module/ModTools/Commands/ConfReload.cs
Normal file
25
Module/ModTools/Commands/ConfReload.cs
Normal file
|
@ -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.
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue