diff --git a/handlers/commands/groups.js b/handlers/commands/groups.js
index 364a29c..55b096b 100644
--- a/handlers/commands/groups.js
+++ b/handlers/commands/groups.js
@@ -3,6 +3,9 @@
// Utils
const { escapeHtml } = require('../../utils/tg');
+// Bot
+const bot = require('../../bot');
+
// DB
const { listGroups } = require('../../stores/group');
@@ -16,19 +19,23 @@ const entry = group => group.username
? `- @${group.username}`
: `- ${escapeHtml(group.title)}`;
-const groupsHandler = async ctx => {
+const groupsHandler = async ({ chat, replyWithHTML }) => {
if (config.groupsString) {
- return ctx.replyWithHTML(config.groupsString);
+ return replyWithHTML(config.groupsString);
}
const groups = await listGroups();
const entries = groups.map(entry).join('\n');
- return ctx.replyWithHTML(`đ Groups I manage:\n\n${entries}`, {
- disable_web_page_preview: true,
- reply_markup,
- });
+ const { message_id } = await replyWithHTML(
+ `đ Groups I manage:\n\n${entries}`, {
+ disable_web_page_preview: true,
+ reply_markup,
+ });
+
+ return setTimeout(() =>
+ bot.telegram.deleteMessage(chat.id, message_id), 5 * 60 * 1000);
};
diff --git a/handlers/commands/link.js b/handlers/commands/link.js
index 1b754e3..bbd201f 100644
--- a/handlers/commands/link.js
+++ b/handlers/commands/link.js
@@ -1,15 +1,20 @@
'use strict';
+// Bot
+const bot = require('../../bot');
+
// DB
const { managesGroup } = require('../../stores/group');
const linkHandler = async ({ chat, replyWithHTML }) => {
const group = await managesGroup(chat);
- return replyWithHTML(
+ const { message_id } = await replyWithHTML(
'âšī¸ Group\'s link:\n\n' +
`${group.title}`
);
+ return setTimeout(() =>
+ bot.telegram.deleteMessage(chat.id, message_id), 5 * 60 * 1000);
};
module.exports = linkHandler;