mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-09-02 15:15:20 +00:00
added /link command
This commit is contained in:
@@ -32,6 +32,7 @@ Command | Rule | Description
|
||||
`/ban <reason>` | _Admin_ | Bans the user from groups.
|
||||
`/unban` | _Admin_ | Removes the user from ban list.
|
||||
`/staff` | _All_ | Shows a list of admins.
|
||||
`/link` | _All_ | Show the current group's link.
|
||||
`/groups` | _All_ | Show a list of groups which the bot is admin in.
|
||||
`/report` | _All_ | Reports the replied-to message to admins.
|
||||
|
||||
|
@@ -16,6 +16,7 @@ const commandReference = `\
|
||||
|
||||
<b>Commands for everyone</b>:
|
||||
<code>/staff</code> - Shows a list of admins.
|
||||
<code>/link</code> - Show the current group's link.
|
||||
<code>/groups</code> - Show a list of groups which the bot is admin in.
|
||||
<code>/report</code> - Reports the replied-to message to admins.
|
||||
`;
|
||||
|
15
handlers/commands/link.js
Normal file
15
handlers/commands/link.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
// DB
|
||||
const { managesGroup } = require('../../stores/group');
|
||||
|
||||
const linkHandler = async ({ chat, replyWithHTML }) => {
|
||||
const group = await managesGroup(chat);
|
||||
|
||||
return replyWithHTML(
|
||||
'ℹ️ <b>Group\'s link:</b>\n\n' +
|
||||
`<a href="${group.link}">${group.title}</a>`
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = linkHandler;
|
2
index.js
2
index.js
@@ -32,6 +32,7 @@ const banHandler = require('./handlers/commands/ban');
|
||||
const unbanHandler = require('./handlers/commands/unban');
|
||||
const reportHandler = require('./handlers/commands/report');
|
||||
const staffHandler = require('./handlers/commands/staff');
|
||||
const linkHandler = require('./handlers/commands/link');
|
||||
const groupsHandler = require('./handlers/commands/groups');
|
||||
const commandReferenceHandler = require('./handlers/commands/commands');
|
||||
const helpHandler = require('./handlers/commands/help');
|
||||
@@ -56,6 +57,7 @@ bot.command('unban', unbanHandler);
|
||||
bot.command('report', reportHandler);
|
||||
bot.hears(/^@admins?$/i, reportHandler);
|
||||
bot.command('staff', staffHandler);
|
||||
bot.command('link', linkHandler);
|
||||
bot.command('groups', groupsHandler);
|
||||
bot.command('commands', commandReferenceHandler);
|
||||
bot.command([ 'start', 'help' ], helpHandler);
|
||||
|
Reference in New Issue
Block a user