E
E
egorlisss2018-12-30 10:32:18
JavaScript
egorlisss, 2018-12-30 10:32:18

VKApi: One of the parameters specified was missing or invalid: user_id not integer?

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[id].id`,
      random_id: 1,
      message: `[Рассылка]:\n->${message.$match[1]}`
    });
  }
  return message.send(`&#9889;Сообщения отправлены!`);
});

user_id I take from json file
{
  "users": {
    "1": {
      "id": 233731786,
....

while getting the error
UnhandledPromiseRejectionWarning: ExecuteError: Code №100 - One of the parameters specified was missing or invalid: user_id not integer

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2018-12-30
@egorlisss

Typo. In square brackets, instead of id, there should be i:

user_id: `acc.users[i].id`,
//                  ^

E
egorlisss, 2018-12-30
@egorlisss

acc.users[numm] = {
      id: message.user,
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question