public async Task HandleCommand(SocketMessage messageParam) { var message = messageParam as SocketUserMessage; if (message == null) { return; } if (message.Author.IsBot) { return; } var context = new CommandContext(client, message); int argPos = 0; if (!(message.HasStringPrefix(triggerMap[context.Guild.Id], ref argPos) || message.HasMentionPrefix(client.CurrentUser, ref argPos))) { MsgInfo info = new MsgInfo() { message = message.Content, user = message.Author.Id }; messageHist[context.Guild.Id].Add(info); markov.WriteToGuild(context.Guild.Id, message.Content); return; } if (IsCommandDisabled(message.Content.Split(' ')[0].Substring(1))) { await context.Channel.SendMessageAsync("That command is disabled!"); return; } var result = await commands.ExecuteAsync(context, argPos, services); if (!result.IsSuccess && !result.ErrorReason.Equals("Unknown command.")) { await context.Channel.SendMessageAsync(result.ErrorReason); } }