E
E
egorlisss2019-03-25 10:52:30
JavaScript
egorlisss, 2019-03-25 10:52:30

How to forbid entering Cyrillic after the command?

vk.updates.hear(/^(?:мини)\s?([^]+)?/i, (message) => { 
  if (!message.$match[1]) {
    return message.send(`💡 Для того чтобы получить статистику определенного игрока на СП-Мини, введите: МИНИ НИКНЕЙМ`);
  }  
  if (message.$match[1].length > 20) {
    return message.send(`⚠Максимальная длина никнейма 20 символов.`);
  }

Required if message.$match[1] contains Cyrillic to send a response

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-03-25
@egorlisss

if (/[а-яё]/i.test(message.$match[1])) {
  // do something
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question