Support for underscores and minuses in Telegram command names

This commit is contained in:
Fabio Manganiello 2020-01-01 22:33:57 +01:00
parent 77ff88360b
commit 846d5ff2eb

View file

@ -46,7 +46,7 @@ class ChatTelegramBackend(Backend):
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
def hook(update, context): def hook(update, context):
msg = update.effective_message msg = update.effective_message
m = re.match('\s*/([0-9a-zA-Z]+)\s*(.*)', msg.text) m = re.match('\s*/([0-9a-zA-Z_-]+)\s*(.*)', msg.text)
cmd = m.group(1).lower() cmd = m.group(1).lower()
args = [arg for arg in re.split('\s+', m.group(2)) if len(arg)] args = [arg for arg in re.split('\s+', m.group(2)) if len(arg)]
self.bus.post(CommandMessageEvent(chat_id=update.effective_chat.id, self.bus.post(CommandMessageEvent(chat_id=update.effective_chat.id,