kudubot.parsing package

Submodules

kudubot.parsing.Command module

class kudubot.parsing.Command.Command(keyword: str, arg_info: List[Tuple[str, Any]])

Bases: object

Class that defines a framework for bot commands

__init__(keyword: str, arg_info: List[Tuple[str, Any]])

Intializes a command :param keyword: The keyword/command argument :param arg_info: A list of tuples modelling the command arguments.

The first element in the tuple is the name of the argument, the second one specifies the type

resolve_args(args: List[str]) → Dict[str, Any]

Converts a list of string arguments into a dictionary of arguments converted to their correct types and associated with the appropriate keys. :param args: The arguments to resolve :return: The resolved arguments

validate(keyword: str, args: List[str]) → bool

Method that evaluates if a given command argument and argument list match the command’s parameters :param keyword: The command argument :param args: The rest of the arguments :return:

kudubot.parsing.CommandParser module

class kudubot.parsing.CommandParser.CommandParser

Bases: object

A parser for bot commands

classmethod commands() → List[kudubot.parsing.Command.Command]

Defines the commands the parser supports :return: The list of commands

classmethod help_text(include_title: bool = False) → str

Generates a help message for the parser :param include_title: Whether or not to include a title :return: The help text for this parser

classmethod name() → str
Returns

The name of the parser

parse(text: str) → Tuple[str, Dict[str, Any]]

Parses a command :param text: The text to parse :return: The (command, arguments)

Module contents