S
S
samperirrrrr2020-05-11 13:58:42
Node.js
samperirrrrr, 2020-05-11 13:58:42

The bot has an error when sending Node js. what should I do?

I write "mailing Bot is working successfully" but the mailing does not send anything to anyone in the console, that's what 5eb92fbad9e90764921562.png

Here is the code!

senya.her(/^(?:рассылка)\s([^]+)/i, async (message) => { 
  if(message.user.polnom < 12) 
    return;
  
  let group_token = `e95c646c9b61ccfa5ebe71d19c4cc414b5704631e8ffb56d3e17ee2aa687bcefe77f799071c5456ff3b9f`; 
  let rs = new VK({ token: group_token }); 
  
  try 
  { 
    let dialogs = await rs.api.messages.getConversations({count: 200, offset: 0}); 
    
    for(i in dialogs.items) 
    { 
      rs.api.messages.send({ 
        peer_id: dialogs.items[i].conversation.peer.id, 
        attachment: `${wall_post}`, 
        message: `${message.args[1]}`,
        keyboard:JSON.stringify({ 
          "inline": true, 
          "buttons":  
          }) 
      }); 
    } 
    for(var i = 1; i < 500; i++) 
    { 
      rs.api.messages.send({ 
      chat_id: i, 
      attachment: `${wall_post}`, 
      message: `${message.args[1]}`, 
      keyboard:JSON.stringify({ 
        "inline": true, 
        "buttons": 
        }) 
      }); 
    } 
    
    return message.send(' рассылка будет отправлена в течении нескольких секунд...') 
  } 
  catch (e) 
  { 
    console.log(`ошибка.`) 
  }	
});

Help please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
THEMOD, 2020-05-11
@samperirrrrr

Print an error to the console. Replace console.log(`error.`) with console.log(e). And give an answer
. Also, the connection of the bot to the group goes like this:

vk.setOptions({ token: 'token', pollingGroupId: id группы });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question