private async Task MessageDeleted(Cacheable <IMessage, ulong> cache, ISocketMessageChannel channel) { IMessage message = cache.Value; if (message?.Source != MessageSource.User) { return; } if (GuildUtils.UserConfigCache.TryGetValue(message.Author.Id, out var userConfig) && userConfig.IsOptedOutSnipe) { return; } MessageCache[message.Id] = new CachedMessage(message, DateTimeOffset.UtcNow, SourceEvent.MessageDeleted); await _logService.LogAsync(new LogMessage(LogSeverity.Verbose, "MsgDeleted", $"1 message deleted by {message.Author} in {channel.Display()}")); }
private async Task MessagesBulkDeleted(IReadOnlyCollection <Cacheable <IMessage, ulong> > msgs, ISocketMessageChannel channel) { await _logService.LogAsync(new LogMessage(LogSeverity.Verbose, "MsgDeleted", $"{msgs.Count} messages deleted in {channel.Display()}")); }
private async Task MessageUpdated(Cacheable <IMessage, ulong> cachedbefore, SocketMessage after, ISocketMessageChannel channel) { if (string.IsNullOrEmpty(after?.Content) || after.Source != MessageSource.User) { return; } if (GuildUtils.UserConfigCache.TryGetValue(after.Author.Id, out var userConfig) && userConfig.IsOptedOutSnipe) { return; } IMessage before = cachedbefore.Value; if (string.IsNullOrEmpty(before?.Content) || before.Content == after.Content) { return; } MessageCache[before.Id] = new CachedMessage(before, DateTimeOffset.UtcNow, SourceEvent.MessageUpdated); await _logService.LogAsync(new LogMessage(LogSeverity.Verbose, "MsgUpdated", $"1 message edited by {after.Author} in {channel.Display()}")); }