2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-23 10:28:09 +00:00
Thomas Rory Gummerson 758b924436
Type ctx
2020-03-13 22:00:30 +01:00

17 lines
434 B
JavaScript

'use strict';
const eq = require('../../utils/eq');
const { isCommand } = require('../../utils/tg');
/** @param { import('telegraf').ContextMessageUpdate } ctx */
module.exports = ({ me, message }) => {
if (!isCommand(message)) return null;
const [ , command, username ] =
/^\/(?:start )?(\w+)(@\w+)?/.exec(message.text);
if (username && !eq.username(username, me)) return null;
return { route: command.toLowerCase() };
};