Merge pull request #235 from dev-kittens/fix/checkyesflag
Fix -yes flag matching on linking other accounts
This commit is contained in:
commit
b15f8404e7
@ -35,7 +35,7 @@ namespace PluralKit.Bot
|
|||||||
|
|
||||||
var msg = $"{account.Mention}, please confirm the link by clicking the {Emojis.Success} reaction on this message.";
|
var msg = $"{account.Mention}, please confirm the link by clicking the {Emojis.Success} reaction on this message.";
|
||||||
var mentions = new IMention[] { new UserMention(account) };
|
var mentions = new IMention[] { new UserMention(account) };
|
||||||
if (!await ctx.PromptYesNo(msg, user: account, mentions: mentions)) throw Errors.MemberLinkCancelled;
|
if (!await ctx.PromptYesNo(msg, user: account, mentions: mentions, matchFlag: false)) throw Errors.MemberLinkCancelled;
|
||||||
await _repo.AddAccount(conn, ctx.System.Id, account.Id);
|
await _repo.AddAccount(conn, ctx.System.Id, account.Id);
|
||||||
await ctx.Reply($"{Emojis.Success} Account linked to system.");
|
await ctx.Reply($"{Emojis.Success} Account linked to system.");
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@ using PluralKit.Core;
|
|||||||
|
|
||||||
namespace PluralKit.Bot {
|
namespace PluralKit.Bot {
|
||||||
public static class ContextUtils {
|
public static class ContextUtils {
|
||||||
public static async Task<bool> PromptYesNo(this Context ctx, String msgString, DiscordUser user = null, Duration? timeout = null, IEnumerable<IMention> mentions = null)
|
public static async Task<bool> PromptYesNo(this Context ctx, String msgString, DiscordUser user = null, Duration? timeout = null, IEnumerable<IMention> mentions = null, bool matchFlag = true)
|
||||||
{
|
{
|
||||||
DiscordMessage message;
|
DiscordMessage message;
|
||||||
if (ctx.MatchFlag("y", "yes")) return true;
|
if (matchFlag && ctx.MatchFlag("y", "yes")) return true;
|
||||||
else message = await ctx.Reply(msgString, mentions: mentions);
|
else message = await ctx.Reply(msgString, mentions: mentions);
|
||||||
var cts = new CancellationTokenSource();
|
var cts = new CancellationTokenSource();
|
||||||
if (user == null) user = ctx.Author;
|
if (user == null) user = ctx.Author;
|
||||||
|
Loading…
Reference in New Issue
Block a user