Answer the question
In order to leave comments, you need to log in
How to make the bot write to a specific conversation?
Who knows how to make the bot write to a specific conversation? Like someone wrote a report, and his report came in another conversation, how to implement it in js, long pool api (vk.api.messages.send). The internet didn't help.
Here is an example of how my send code to a specific person looks like:
cmd.hear(/^(?:репорт|реп|rep|жалоба)\s([^]+)$/i, async (message, bot) => {
if(message.isChat) return bot(`команда работает только в ЛС.`);
vk.api.messages.send({ user_id: 276301156, forward_messages: message.id, message: `Player id: ${message.user.uid}. Ответить: Ответ ${message.user.uid} ваш ответ` }).then(() => {
return bot(`ваше сообщение отправлено.`);
}).catch((err) => {
return bot(`произошла ошибка при отправлении сообщения технической поддержке.`);
});
});
Answer the question
In order to leave comments, you need to log in
First you need to get the id of the desired conversation. By type 2000000010
Next, use this code
vk.api.messages.send({ peer_id: `2000000010`, message: `Репорт пользователя` }).then(() => {
return bot(`ваше сообщение отправлено.`);
}).catch((err) => {
return bot(`произошла ошибка при отправлении сообщения технической поддержке.`);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question