D
D
da_da_ya_neudachnik2022-02-09 14:20:11
JavaScript
da_da_ya_neudachnik, 2022-02-09 14:20:11

How to make VK JS mailing work?

Guys, help, please, I don’t understand what I’m doing wrong, I want to understand how to make a newsletter in VK JS.

cmd.hear(/^(?:рассылка)\s([^]+)$/i, async (message, bot) => {
if(message.user.settings.adm < 4) return;
users.filter(x=> x.id !== 1).map(zz => {
vk.api.messages.send({ user_id: zz.id, message: `${message.args[1]}`});
});
let people = 0;
bot(`рассылка отправлена!`);
for(let id in users) {
vk.api.call('messages.send', {
chat_id: id,
message: `${message.args[1]}` });
}
return;
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
defriz, 2022-02-09
@da_da_ya_neudachnik

cmd.hear(/^(?:рассылка)\s([^]+)$/i, async (message, bot) => {
if(message.user.settings.adm < 4) return;
for (let i = 0;i<users.length;i++) {
if(users[i]) vk.api.messages.send({ peer_id: users[i].id, message: `${message.args[1]}`});
};
let people = 0;
bot(`рассылка отправлена!`);
return;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question