private Task OnMessageReceivedAsync(IMessage socketMsg) => _taskService.TryRun(async() => { var msg = socketMsg as IUserMessage; if (msg == null || msg.Author.IsBot || msg.Embeds.Count > 0) { return; } var ctx = new Context(_client, msg, _provider); await ctx.InitializeAsync(); var isRateLimited = _rateLimitService.IsIgnored(ctx.User.Id); var isSpammer = ctx.Guild != null && ctx.DbGuild.AutoMute && !await _spamService.AuthenticateAsync(ctx); if (isRateLimited || isSpammer) { return; } int argPos = 0; if (!msg.HasStringPrefix(Config.PREFIX, ref argPos)) { await _chatService.ApplyAsync(ctx); return; } var result = await _commandService.ExecuteAsync(ctx, argPos, _provider); await _resultService.HandleResultAsync(ctx, result, argPos); });