mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-22 10:55:15 -04:00
Add has:pin filter (#853)
Adds a new `has:*` filter. Specifically, `has:pin`. The filter filters for messages that are pinned.
This commit is contained in:
parent
6621c10ae0
commit
20eeaa58e9
3 changed files with 5 additions and 2 deletions
|
@ -19,6 +19,7 @@ internal class HasMessageFilter : MessageFilter
|
|||
MessageContentMatchKind.Video => message.Attachments.Any(file => file.IsVideo),
|
||||
MessageContentMatchKind.Image => message.Attachments.Any(file => file.IsImage),
|
||||
MessageContentMatchKind.Sound => message.Attachments.Any(file => file.IsAudio),
|
||||
MessageContentMatchKind.Pin => message.IsPinned,
|
||||
_ => throw new InvalidOperationException($"Unknown message content match kind '{_kind}'.")
|
||||
};
|
||||
}
|
|
@ -7,5 +7,6 @@ internal enum MessageContentMatchKind
|
|||
File,
|
||||
Video,
|
||||
Image,
|
||||
Sound
|
||||
Sound,
|
||||
Pin
|
||||
}
|
|
@ -58,7 +58,8 @@ internal static class FilterGrammar
|
|||
Span.EqualToIgnoreCase("file").IgnoreThen(Parse.Return(MessageContentMatchKind.File)),
|
||||
Span.EqualToIgnoreCase("video").IgnoreThen(Parse.Return(MessageContentMatchKind.Video)),
|
||||
Span.EqualToIgnoreCase("image").IgnoreThen(Parse.Return(MessageContentMatchKind.Image)),
|
||||
Span.EqualToIgnoreCase("sound").IgnoreThen(Parse.Return(MessageContentMatchKind.Sound))
|
||||
Span.EqualToIgnoreCase("sound").IgnoreThen(Parse.Return(MessageContentMatchKind.Sound)),
|
||||
Span.EqualToIgnoreCase("pin").IgnoreThen(Parse.Return(MessageContentMatchKind.Pin))
|
||||
))
|
||||
.Select(k => (MessageFilter) new HasMessageFilter(k))
|
||||
.Named("has:<value>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue