GramCore/plugin/methods/get_args.py

25 lines
684 B
Python
Raw Normal View History

2023-12-16 09:36:19 +00:00
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 []