private void Form1_Load(object sender, EventArgs e) { if (System.IO.File.Exists("commands.xml")) { SimpleCommands.FromFile("commands.xml"); } else { SimpleCommands.Save("commands.xml"); } }
private async Task HandleCommandAsync(SocketMessage s) { var msg = s as SocketUserMessage; if (msg == null) { return; } var context = new SocketCommandContext(Client, msg); int argPos = 0; await SimpleCommands.Execute(context, s.Content); if (msg.HasStringPrefix(Program.Form.Bot.Config.CmdPrefix, ref argPos) || msg.HasMentionPrefix(Client.CurrentUser, ref argPos)) { var result = await Service.ExecuteAsync(context, argPos, null); if (!result.IsSuccess && result.Error != CommandError.UnknownCommand) { Program.Form.Log(result.ErrorReason); } } }
private void CommandsEditor_FormClosing(object sender, FormClosingEventArgs e) { SimpleCommands.Commands = Commands; SimpleCommands.Save("commands.xml"); }