RegexBot/Module/ModTools/Commands/ConfReload.cs
2018-03-04 20:14:54 -08:00

25 lines
924 B
C#

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.
}
}