nick already exists validation

master
Kit Kasune 3 years ago
parent a5a1ef55e9
commit 88ae4fa583
  1. 1
      commands/anime/char.js

@ -504,6 +504,7 @@ module.exports = {
let ch = await Char.findOne({id: fn}); 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); let nn = await ask(message, `What nickname would you like to add to ${ch.name}?`, 60000, false, true);
if (!nn) {return;} 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) { if (!queue) {
ch.nicknames.push(nn); ch.nicknames.push(nn);
ch.markModified('nicknames'); ch.markModified('nicknames');

Loading…
Cancel
Save