GramCore/plugin/methods/get_args.py
2023-12-16 17:36:19 +08:00

25 lines
684 B
Python

from typing import List, TYPE_CHECKING
if TYPE_CHECKING:
from telegram.ext import CallbackContext
class GetArgs:
@staticmethod
def get_args(context: "CallbackContext") -> List[str]:
args = context.args
match = context.match
if args is None:
if match is not None and (command := match.groups()[0]):
temp = []
command_parts = command.split(" ")
for command_part in command_parts:
if command_part:
temp.append(command_part)
return temp
return []
if len(args) >= 1:
return args
return []