/// <summary> /// Handle a user message event /// </summary> /// <param name="arg"></param> /// <returns></returns> private async Task HandleCommandAsync(SocketMessage arg) { SocketUserMessage msg = arg as SocketUserMessage; if (msg is null || msg.Author.IsBot) { return; } int argPos = 0; if (msg.HasStringPrefix(prefix.ToString(), ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { SocketCommandContext context = new SocketCommandContext(_client, msg); Debug.WriteLine(context.Message); Debug.WriteLine(context.ToString()); IResult result = await _commands.ExecuteAsync(context, argPos, _services); if (result.IsSuccess == false) { Program.MainWindow.Output(result.ErrorReason); await msg.Channel.SendMessageAsync(result.ErrorReason); } } }