mirror of
https://github.com/PaiGramTeam/GramCore.git
synced 2024-11-25 07:36:27 +00:00
25 lines
684 B
Python
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 []
|