mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-31 22:25:15 +00:00
Use router instead of composer in commands/index
+ Makes commands case-insensitive + Avoids hardcoding commands in commands/addCommand
This commit is contained in:
10
utils/tg.js
10
utils/tg.js
@@ -2,6 +2,15 @@
|
||||
|
||||
const { telegram } = require('../bot');
|
||||
|
||||
const R = require('ramda');
|
||||
|
||||
const isCommand = R.pipe(
|
||||
R.defaultTo({}),
|
||||
R.path([ 'entities', 0 ]),
|
||||
R.defaultTo({}),
|
||||
R.whereEq({ offset: 0, type: 'bot_command' }),
|
||||
);
|
||||
|
||||
const escapeHtml = s => s
|
||||
.replace(/</g, '<');
|
||||
|
||||
@@ -36,6 +45,7 @@ const scheduleDeletion = ({ chat, message_id }) => {
|
||||
module.exports = {
|
||||
deleteAfter,
|
||||
escapeHtml,
|
||||
isCommand,
|
||||
link,
|
||||
quietLink,
|
||||
scheduleDeletion,
|
||||
|
Reference in New Issue
Block a user