Skip to content

Commit b37e70b

Browse files
authored
Merge pull request #1298 from mslxl/master
Allow commands ending with bot mention (handle /command@botname)
2 parents 1c08b52 + 2d8913e commit b37e70b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/main/src/telegram_bot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export default class TelegramBot {
7777
}
7878

7979
// Then check if it's a command starting with /
80-
if (args.at(0)?.startsWith('/')) {
81-
const command = args.at(0)?.slice(1) ?? '';
80+
if (args[0] && args[0].startsWith('/')) {
81+
const command = args[0].substring(1, args[0].lastIndexOf('@') > -1 ? args[0].lastIndexOf('@') : args[0].length);
8282
return command in this.commands ? command : this.defaultCommand;
8383
}
8484

0 commit comments

Comments
 (0)