M
M
Mimocodil2021-04-05 08:17:50
Java
Mimocodil, 2021-04-05 08:17:50

How to delete last bot message in Telegram Bot API?

I send messages using the method

public void sendMsg(long id, String text) {
    SendMessage msg = new SendMessage();
    msg.setChatId(id + "");
    msg.setText(text);
    try {
        execute(msg);
    } catch (TelegramApiException e) {
        e.printStackTrace();
    }
}

The documentation says to use deleteMessage(int chat_id, int message_id) , but I can't figure out how to get the message_id from the SendMessage instance.

Can you please tell me how to find out the message_id of the last message?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Inoyatullo, 2021-04-08
@Khaliknazar

I don't really understand Java, but after sending a message, the msg variable will have a message_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question