Answer the question
In order to leave comments, you need to log in
Proper deletion of previous messages in a telegram bot?
This is how I write messages to the ID session in each menu and delete them when I go to another page. (or rather, I now delete it when the user "back" - goes back to the main one) - but still. add an entry to the message ID session everywhere + in each scene a line to delete the previous one and clean up the array with IDs in the session. I think this is my own bike (it turns out to be a curve). Maybe there is already a solution? Or something more elegant. Or is it normal?
entryMenu(arrayOfLabel) {
const entryMenuScene = new Scene('entryMenu');
entryMenuScene.enter(async (ctx) => {
await ctx.replyWithPhoto({ source: './img/headerMenu.jpg' }).then((ctx2) => ctx.session.arr.push(ctx2.message_id));
await ctx.reply(`*${ctx.from.first_name}*. Добро пожаловать !`, arrayOfLabel).then((ctx2) => ctx.session.arr.push(ctx2.message_id));
});
await ctx.reply(`Бот:\n${ctx.from.first_name} (@${ctx.from.username})`, Botmenu, botPanelKeyboard).then((ctx2) => ctx.session.arr.push(ctx2.message_id));
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