E
E
egorlisss2018-12-30 18:40:18
JavaScript
egorlisss, 2018-12-30 18:40:18

How to hide error in console?

vk.updates.hear(/^(?:никнейм)\s?([^]+)?/i,  (message) => { 
  let user = acc.users[user_id(message.user)]; 
    let zaprets1 = message.$match[1].toLowerCase();
  var zapret = /(запрещённые слова)/
  if (zapret.test(zaprets1) == true) { 
      return message.send(`⚠Вы не можете использовать этот никнейм!`);
  }
  var filter0 = /(http(s)?:\/\/.)?(www\.)?[[email protected]:%._\+~#=]{1,256}\.[a-z]{2,6}/
  var filter1 = /(?!http(s)?:\/\/)?(www\.)?[а-я0-9-_.]{1,256}\.(запрещённые слова)/
  var lol = filter0.test(zaprets1)
  var lol1 = filter1.test(zaprets1)	
  if (filter0.test(zaprets1) == true || filter1.test(zaprets1) == true) { 
    return message.send(`⚠Вы не можете использовать этот никнейм!`);
  }
  if(message.$match[1].length > 15) return message.send(`⚠Максимальная длина никнейма 15 символов.`);
  user.prefix = message.$match[1];
  return message.send(`💡Никнейм изменён на: ${message.$match[1]}`);
});

When sending "Nickname" I get:
durF4OsGGvU.jpg
It is necessary if the person does not indicate anything after the word Nickname received an answer, and so that the console does not swear.

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
Stockholm Syndrome, 2018-12-30
@egorlisss

let zaprets1 = (message.$match[1] || '').toLowerCase();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question