From 88ae4fa5837eb97cb7bb3cdce1335420048b02a6 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 24 Dec 2021 01:52:46 -0700 Subject: [PATCH] nick already exists validation --- commands/anime/char.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/anime/char.js b/commands/anime/char.js index 0413423..045a6a5 100644 --- a/commands/anime/char.js +++ b/commands/anime/char.js @@ -504,6 +504,7 @@ module.exports = { let ch = await Char.findOne({id: fn}); let nn = await ask(message, `What nickname would you like to add to ${ch.name}?`, 60000, false, true); if (!nn) {return;} + if (ch.nicknames.map(nickn => nickn.toLowerCase()).includes(nn.toLowerCase())) {return message.channel.send(`Looks like **${ch.name}** already has the nickname "${nn}".`);} if (!queue) { ch.nicknames.push(nn); ch.markModified('nicknames');