Check if we got the same member before asking for confirmation (#201)

This commit is contained in:
kittens 2020-07-22 10:27:53 -04:00 committed by GitHub
parent 467d058565
commit e24c5d095b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,8 @@ namespace PluralKit.Bot
// Warn if there's already a member by this name // Warn if there's already a member by this name
var existingMember = await _data.GetMemberByName(ctx.System, newName); var existingMember = await _data.GetMemberByName(ctx.System, newName);
if (existingMember != null) { if (existingMember != null)
if (existingMember.Id != target.Id) {
var msg = $"{Emojis.Warn} You already have a member in your system with the name \"{existingMember.NameFor(ctx)}\" (`{existingMember.Hid}`). Do you want to rename this member to that name too?"; var msg = $"{Emojis.Warn} You already have a member in your system with the name \"{existingMember.NameFor(ctx)}\" (`{existingMember.Hid}`). Do you want to rename this member to that name too?";
if (!await ctx.PromptYesNo(msg)) throw new PKError("Member renaming cancelled."); if (!await ctx.PromptYesNo(msg)) throw new PKError("Member renaming cancelled.");
} }