E
E
egorlisss2019-03-22 17:30:27
JavaScript
egorlisss, 2019-03-22 17:30:27

Make a rights system for commands?

For example, if the user whose id is not recorded in the bot, he will not be able to use it and he will receive an answer about that.
Tried to use Json but didn't work.

vk.updates.hear(/^(?:рассылка)\s?([^]+)?/i,  message => { 
  if(acc.users[user_id(message.user)].level < 4) return;
  for(i in acc.users){
    vk.api.call('messages.send', {
      user_id: acc.users[i].id,
      random_id: 100000000,
      message: `${message.$match[1]}`
    });
  }
  return message.send(`&#9889;Сообщения отправлены!`);
});

eWuToIau8zI.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question