Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { deunionize } from 'telegraf';
- import { Context } from '../interfaces';
- export const getCommandArgs = (ctx: Context): string | null => {
- const messageText = deunionize(ctx.message).text;
- const argsFromCommandRegex = /\/(?:\w+)(?:@\w+?_bot)? (?<args>.*)/i;
- const args = argsFromCommandRegex.exec(messageText);
- if (!args) {
- return null;
- }
- return args.groups.args.trim();
- };
Advertisement
Add Comment
Please, Sign In to add comment