Add -yes flag to CheckYesNo (#198)

This commit is contained in:
kittens
2020-07-20 20:10:26 -04:00
committed by GitHub
parent 6054080dc7
commit fd0e46f40d
8 changed files with 21 additions and 24 deletions

View File

@@ -27,9 +27,9 @@ namespace PluralKit.Bot
var existingAccount = await _data.GetSystemByAccount(account.Id);
if (existingAccount != null) throw Errors.AccountInOtherSystem(existingAccount);
var msg = await ctx.Reply($"{account.Mention}, please confirm the link by clicking the {Emojis.Success} reaction on this message.",
mentions: new IMention[] { new UserMention(account) });
if (!await ctx.PromptYesNo(msg, user: account)) throw Errors.MemberLinkCancelled;
var msg = $"{account.Mention}, please confirm the link by clicking the {Emojis.Success} reaction on this message.";
var mentions = new IMention[] { new UserMention(account) };
if (!await ctx.PromptYesNo(msg, user: account, mentions: mentions)) throw Errors.MemberLinkCancelled;
await _data.AddAccount(ctx.System, account.Id);
await ctx.Reply($"{Emojis.Success} Account linked to system.");
}
@@ -48,8 +48,7 @@ namespace PluralKit.Bot
if (!accountIds.Contains(id)) throw Errors.AccountNotLinked;
if (accountIds.Count == 1) throw Errors.UnlinkingLastAccount;
var msg = await ctx.Reply(
$"Are you sure you want to unlink <@{id}> from your system?");
var msg = $"Are you sure you want to unlink <@{id}> from your system?";
if (!await ctx.PromptYesNo(msg)) throw Errors.MemberUnlinkCancelled;
await _data.RemoveAccount(ctx.System, id);