Answer the question
In order to leave comments, you need to log in
When I try to get message id, I get error 100, what's the problem?
I am writing a bot in NodeJS, there was a problem. I was going to write a command that will delete the forwarded message.
Here is the code:
cmd.hear(/^(?:-смсс)$/i, async (message, bot) => {
if (message.hasForwards) {
await message.loadMessagePayload();
}
message.fwds = message.forwards;
message.attachs = message.attachments;
console.log('Forwards', message.fwds[0].text, message.fwds[0].senderId);
const sms = user.api.messages.search({ q: message.fwds[0].text, peer_id: message.fwds[0].senderId, count: 1 });
user.api.messages.delete({ message_ids: sms.id, delete_for_all: 1 }), (data, error) => {
if (error) {
return message.send('Ошибка выполнения метода', error)
} else {
console.log(data)
return message.send('сообщение удалено')
}
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question