添加处理 args 的函数

This commit is contained in:
洛水居室 2022-07-30 20:53:28 +08:00
parent c72159b357
commit 9604eb21ef
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

17
utils/bot.py Normal file
View File

@ -0,0 +1,17 @@
from typing import List
from telegram.ext import CallbackContext
def get_all_args(context: CallbackContext) -> List[str]:
args = context.args
match = context.match
if args is None:
if match is not None:
groups = match.groups()
return list(groups)
else:
if len(args) >= 1:
return args
return []