File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 33// Utils
44const { escapeHtml } = require ( '../../utils/tg' ) ;
55
6+ // Bot
7+ const bot = require ( '../../bot' ) ;
8+
69// DB
710const { listGroups } = require ( '../../stores/group' ) ;
811
@@ -16,19 +19,23 @@ const entry = group => group.username
1619 ? `- @${ group . username } `
1720 : `- <a href="${ group . link } ">${ escapeHtml ( group . title ) } </a>` ;
1821
19- const groupsHandler = async ctx => {
22+ const groupsHandler = async ( { chat , replyWithHTML } ) => {
2023 if ( config . groupsString ) {
21- return ctx . replyWithHTML ( config . groupsString ) ;
24+ return replyWithHTML ( config . groupsString ) ;
2225 }
2326
2427 const groups = await listGroups ( ) ;
2528
2629 const entries = groups . map ( entry ) . join ( '\n' ) ;
2730
28- return ctx . replyWithHTML ( `🛠 <b>Groups I manage</b>:\n\n${ entries } ` , {
29- disable_web_page_preview : true ,
30- reply_markup,
31- } ) ;
31+ const { message_id } = await replyWithHTML (
32+ `🛠 <b>Groups I manage</b>:\n\n${ entries } ` , {
33+ disable_web_page_preview : true ,
34+ reply_markup,
35+ } ) ;
36+
37+ return setTimeout ( ( ) =>
38+ bot . telegram . deleteMessage ( chat . id , message_id ) , 5 * 60 * 1000 ) ;
3239
3340} ;
3441
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ // Bot
4+ const bot = require ( '../../bot' ) ;
5+
36// DB
47const { managesGroup } = require ( '../../stores/group' ) ;
58
69const linkHandler = async ( { chat, replyWithHTML } ) => {
710 const group = await managesGroup ( chat ) ;
811
9- return replyWithHTML (
12+ const { message_id } = await replyWithHTML (
1013 'ℹ️ <b>Group\'s link:</b>\n\n' +
1114 `<a href="${ group . link } ">${ group . title } </a>`
1215 ) ;
16+ return setTimeout ( ( ) =>
17+ bot . telegram . deleteMessage ( chat . id , message_id ) , 5 * 60 * 1000 ) ;
1318} ;
1419
1520module . exports = linkHandler ;
You can’t perform that action at this time.
0 commit comments