private async Task HandleCommandAsync(SocketMessage arg) { await MessageCreateHandler.CreateMessage(arg, Client); if (!(arg is SocketUserMessage message) || message.Author.IsBot || message.Author.IsWebhook) { return; } // Where the arguments start. int argPos = 0; // Make sure the message starts with the prefix, or mentions the CurrentUser if (message.HasStringPrefix(Prefix, ref argPos) || message.HasMentionPrefix(Client.CurrentUser, ref argPos)) { SocketCommandContext context = new SocketCommandContext(Client, message); IResult res = await _commands.ExecuteAsync(context, argPos, _services); if (!res.IsSuccess) { Console.WriteLine(res.ErrorReason); } } }
public MessageAddWindow(MessageCreateHandler messageCreateHandler) { InitializeComponent(); MessageCreateEvent += messageCreateHandler; _exceptionCatcher = new ExceptionCatcher(); }