mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 23:07:54 +00:00
fix(bot): make deletion ID checks accept hyphens/caps
This commit is contained in:
parent
eccab602d5
commit
7965e15282
4 changed files with 20 additions and 15 deletions
|
|
@ -55,7 +55,7 @@ public static class ContextUtils
|
|||
.WaitFor(ReactionPredicate, timeout);
|
||||
}
|
||||
|
||||
public static async Task<bool> ConfirmWithReply(this Context ctx, string expectedReply)
|
||||
public static async Task<bool> ConfirmWithReply(this Context ctx, string expectedReply, bool treatAsHid = false)
|
||||
{
|
||||
bool Predicate(MessageCreateEvent e) =>
|
||||
e.Author.Id == ctx.Author.Id && e.ChannelId == ctx.Channel.Id;
|
||||
|
|
@ -63,7 +63,11 @@ public static class ContextUtils
|
|||
var msg = await ctx.Services.Resolve<HandlerQueue<MessageCreateEvent>>()
|
||||
.WaitFor(Predicate, Duration.FromMinutes(1));
|
||||
|
||||
return string.Equals(msg.Content, expectedReply, StringComparison.InvariantCultureIgnoreCase);
|
||||
var content = msg.Content;
|
||||
if (treatAsHid)
|
||||
content = content.ToLower().Replace("-", null);
|
||||
|
||||
return string.Equals(content, expectedReply, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
public static async Task Paginate<T>(this Context ctx, IAsyncEnumerable<T> items, int totalCount,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue