mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-22 07:08:04 +00:00
✨ 添加处理 args
的函数
This commit is contained in:
parent
c72159b357
commit
9604eb21ef
17
utils/bot.py
Normal file
17
utils/bot.py
Normal 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 []
|
Loading…
Reference in New Issue
Block a user