M
M
Maxim Recipient2019-09-06 17:23:19
In contact with
Maxim Recipient, 2019-09-06 17:23:19

How to get message id?

To perform many actions, as written in the VK documentation, a message identifier is required, but the question is where to get it from.
Who knows, he can at least tell you how to get the id of the last message sent by the community itself (to use the messages.edit method).

The code

cmd.hear(/^(?:редактировать)\s(.*)\s(.*)$/i, async (message, bot) => { //---
                                                                       // /s - пробел,
                                                                       // (.*)[1] - id сообщения,
                                     // (.*)[2] - текст для редакции сообщения,
                                     //  например: "редактировать 5894346 пока"
vk.api.messages.edit({
    
  peer_id: 20000000003,
  message: `пока`,
  message_id: ??????????
  keep_forward_messages: 1,
  group_id: 184895474,
  dont_parse_links: 1
  
});

});


Please help with writing a little code to get the last message so that I can insert the message id into message_idand use it in the future. Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pigeon1235, 2019-09-07
@Pigeon1235

If the bot is on the VK-IO library, then PS
If the bot is in a group, then as far as I know they cannot receive message ids

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question