2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-23 18:38:05 +00:00

17 lines
434 B
JavaScript
Raw Permalink Normal View History

'use strict';
const eq = require('../../utils/eq');
const { isCommand } = require('../../utils/tg');
2020-03-10 22:10:48 +01:00
/** @param { import('telegraf').ContextMessageUpdate } ctx */
module.exports = ({ me, message }) => {
if (!isCommand(message)) return null;
2019-06-27 15:05:28 +02:00
const [ , command, username ] =
/^\/(?:start )?(\w+)(@\w+)?/.exec(message.text);
if (username && !eq.username(username, me)) return null;
return { route: command.toLowerCase() };
};