File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed
Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ Command | Rule | Description
3232` /ban <reason> ` | _ Admin_ | Bans the user from groups.
3333` /unban ` | _ Admin_ | Removes the user from ban list.
3434` /staff ` | _ All_ | Shows a list of admins.
35+ ` /link ` | _ All_ | Show the current group's link.
3536` /groups ` | _ All_ | Show a list of groups which the bot is admin in.
3637` /report ` | _ All_ | Reports the replied-to message to admins.
3738
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const commandReference = `\
1616
1717<b>Commands for everyone</b>:
1818<code>/staff</code> - Shows a list of admins.
19+ <code>/link</code> - Show the current group's link.
1920<code>/groups</code> - Show a list of groups which the bot is admin in.
2021<code>/report</code> - Reports the replied-to message to admins.
2122` ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ // DB
4+ const { managesGroup } = require ( '../../stores/group' ) ;
5+
6+ const linkHandler = async ( { chat, replyWithHTML } ) => {
7+ const group = await managesGroup ( chat ) ;
8+
9+ return replyWithHTML (
10+ 'ℹ️ <b>Group\'s link:</b>\n\n' +
11+ `<a href="${ group . link } ">${ group . title } </a>`
12+ ) ;
13+ } ;
14+
15+ module . exports = linkHandler ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const banHandler = require('./handlers/commands/ban');
3232const unbanHandler = require ( './handlers/commands/unban' ) ;
3333const reportHandler = require ( './handlers/commands/report' ) ;
3434const staffHandler = require ( './handlers/commands/staff' ) ;
35+ const linkHandler = require ( './handlers/commands/link' ) ;
3536const groupsHandler = require ( './handlers/commands/groups' ) ;
3637const commandReferenceHandler = require ( './handlers/commands/commands' ) ;
3738const helpHandler = require ( './handlers/commands/help' ) ;
@@ -56,6 +57,7 @@ bot.command('unban', unbanHandler);
5657bot . command ( 'report' , reportHandler ) ;
5758bot . hears ( / ^ @ a d m i n s ? $ / i, reportHandler ) ;
5859bot . command ( 'staff' , staffHandler ) ;
60+ bot . command ( 'link' , linkHandler ) ;
5961bot . command ( 'groups' , groupsHandler ) ;
6062bot . command ( 'commands' , commandReferenceHandler ) ;
6163bot . command ( [ 'start' , 'help' ] , helpHandler ) ;
You can’t perform that action at this time.
0 commit comments