2018-03-05 04:14:54 +00:00
|
|
|
|
using Discord.WebSocket;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2018-03-10 06:17:55 +00:00
|
|
|
|
namespace Noikoio.RegexBot.Module.ModCommands.Commands
|
2018-03-05 04:14:54 +00:00
|
|
|
|
{
|
2018-03-10 06:17:55 +00:00
|
|
|
|
class ConfReload : Command
|
2018-03-05 04:14:54 +00:00
|
|
|
|
{
|
|
|
|
|
// No configuration.
|
2018-03-10 06:17:55 +00:00
|
|
|
|
public ConfReload(CommandListener l, string label, JObject conf) : base(l, label, conf) { }
|
2018-03-05 04:14:54 +00:00
|
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
}
|
|
|
|
|
}
|