mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-23 10:19:39 +00:00
try to fix some errors I noticed in logs
This commit is contained in:
parent
42fdd9556b
commit
fd0c730f81
@ -133,18 +133,21 @@ internal static class ContentFilter
|
||||
#endif
|
||||
|
||||
var content = new StringBuilder(message.Content);
|
||||
foreach (var attachment in message.Attachments)
|
||||
content.AppendLine(attachment.FileName);
|
||||
foreach (var embed in message.Embeds)
|
||||
{
|
||||
content.AppendLine(embed.Title)
|
||||
.AppendLine(embed.Description);
|
||||
foreach (var field in embed.Fields)
|
||||
if (message.Attachments is not null)
|
||||
foreach (var attachment in message.Attachments.Where(a => a is not null))
|
||||
content.AppendLine(attachment.FileName);
|
||||
if (message.Embeds is not null)
|
||||
foreach (var embed in message.Embeds.Where(e => e is not null))
|
||||
{
|
||||
content.AppendLine(field.Name);
|
||||
content.AppendLine(field.Value);
|
||||
content.AppendLine(embed.Title)
|
||||
.AppendLine(embed.Description);
|
||||
if (embed.Fields is not null)
|
||||
foreach (var field in embed.Fields.Where(f => f is not null))
|
||||
{
|
||||
content.AppendLine(field.Name);
|
||||
content.AppendLine(field.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
var trigger = await FindTriggerAsync(FilterContext.Chat, content.ToString()).ConfigureAwait(false);
|
||||
if (trigger == null)
|
||||
return true;
|
||||
|
@ -78,7 +78,7 @@ internal static class DiscordInviteFilter
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Config.Log.Warn($"Some missing permissions in #{channel.Name}: {e.Message}");
|
||||
Config.Log.Warn(e, $"Some missing permissions in #{channel.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ internal static class GlobalMessageCache
|
||||
lock (MessageQueue)
|
||||
{
|
||||
if (!MessageQueue.TryGetValue(args.Channel.Id, out queue))
|
||||
MessageQueue[args.Channel.Id] = queue = new FixedLengthBuffer<ulong, DiscordMessage>(KeyGen);
|
||||
MessageQueue[args.Channel.Id] = queue = new(KeyGen);
|
||||
}
|
||||
lock(queue.SyncObj)
|
||||
queue.Add(args.Message);
|
||||
@ -83,7 +83,7 @@ internal static class GlobalMessageCache
|
||||
if (!MessageQueue.TryGetValue(ch.Id, out var queue))
|
||||
lock (MessageQueue)
|
||||
if (!MessageQueue.TryGetValue(ch.Id, out queue))
|
||||
MessageQueue[ch.Id] = queue = new FixedLengthBuffer<ulong, DiscordMessage>(KeyGen);
|
||||
MessageQueue[ch.Id] = queue = new(KeyGen);
|
||||
List<DiscordMessage> result;
|
||||
lock(queue.SyncObj)
|
||||
result = queue.Reverse().Take(count).ToList();
|
||||
@ -114,7 +114,7 @@ internal static class GlobalMessageCache
|
||||
if (!MessageQueue.TryGetValue(ch.Id, out var queue))
|
||||
lock (MessageQueue)
|
||||
if (!MessageQueue.TryGetValue(ch.Id, out queue))
|
||||
MessageQueue[ch.Id] = queue = new FixedLengthBuffer<ulong, DiscordMessage>(KeyGen);
|
||||
MessageQueue[ch.Id] = queue = new(KeyGen);
|
||||
List<DiscordMessage> result;
|
||||
lock(queue.SyncObj)
|
||||
result = queue.Reverse().SkipWhile(m => m.Id >= msgId).Take(count).ToList();
|
||||
|
Loading…
Reference in New Issue
Block a user