private async Task HandleCommandAsync(SocketMessage arg) { var message = arg as SocketUserMessage; if (message is null || message.Author.IsBot) { return; } int argPos = 0; var hasPrefix = message.HasStringPrefix(discordBotConfig.cmdPrefix, ref argPos); var context = new SocketCommandContext(_client, message); if (!hasPrefix) { await KeyWordChecker.CheckMessageForKeyWord(message.Content, context); } if (hasPrefix || message.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var result = await _commands.ExecuteAsync(context, argPos, _services); if (!result.IsSuccess) { Console.WriteLine(result.ErrorReason); } } }
public async Task ShowAll() { var output = KeyWordChecker.ShowAll_KeyToWords(); await ReplyAsync(output); }
public async Task Clear() { KeyWordChecker.Clear_KeyToWords(); await ReplyAsync("Cleared"); }
public async Task Remove(string key) { var output = KeyWordChecker.RemoveKey_KeyToWords(key); await ReplyAsync(output); }
public async Task AddOrUpdate(string key, SocketUser user, [Remainder] string message = null) { string output = KeyWordChecker.AddOrUpdateKey_KeyToWords(key, user.Mention + " " + message); await ReplyAsync(output); }
public async Task AddOrUpdate(string key, [Remainder] string word = null) { string output = KeyWordChecker.AddOrUpdateKey_KeyToWords(key, word); await ReplyAsync(output); }