From 9604eb21ef129b6642640796987253a21ad84794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 30 Jul 2022 20:53:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E5=A4=84?= =?UTF-8?q?=E7=90=86=20`args`=20=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/bot.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 utils/bot.py diff --git a/utils/bot.py b/utils/bot.py new file mode 100644 index 0000000..1666750 --- /dev/null +++ b/utils/bot.py @@ -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 []