Answer the question
In order to leave comments, you need to log in
How to make the message go through all NODEJS conversations?
bot.command("/msg", async (ctx) => {
bot.execute("messages.send", {
peer_ids: "",
random_id: Math.floor(Math.random() * (200000000 - 1)) + 200000000,
v
: "5.81",
message: "",
})
.catch(e => console.log(e))
})
?
Answer the question
In order to leave comments, you need to log in
My version:
cmd.hear(/^(?:setwall)\s(.*)$/i, async (message, bot) => {
if(проверка на админа) return bot(`защищённое поле, недоступное вам для редактирования`);
message.args[1] = message.args[1].replace("wall", "");
message.args[1] = message.args[1].split('_');
wall_to_send = "wall" + message.args[1][0] + "_" + message.args[1][1];
return bot(`обновлён пост для рассылки`);
});
cmd.hear(/^(?:textsend)\s([^]+)/i, async (message, bot) => {
if(проверка на админа) return bot(`защищённое поле, недоступное вам для редактирования`);
await bot(`рассылка завершена`);
users.map(user => {
vk.api.messages.send({ user_id: user.id, message: message.args[1], attachment: wall_to_send }).then(() => {
console.log(`SENDED ${user.id}`)
}).catch((err) => {
console.log(`NOOOOT ${user.id}`)
});
});
for(var i = 1; i < 20; i++) {
vk.api.messages.send({ peer_id: 2000000000 + i, message: message.args[1], attachment: wall_to_send }).then(() => {
console.log(`CHAT SENDED ${user.id}`)
}).catch((err) => {
console.log(`CHAT NOOOOT ${user.id}`)
});
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question