Class Stark
This is the main class of PyStark. This guide will explain the usage of important functions in Stark
class.
- class Stark
- activate(plugins: Union[str, list[str]] = 'plugins', default_plugins: bool = True, set_menu=True)
Activate/Run your bot.
- Parameters
plugins (str) – Path of the ‘plugins’ directory in relation to the root directory. If name of your directory is ‘files’ and it is in the same folder as ‘bot.py’, pass plugin=’files’. Defaults to ‘plugins’, i.e, a folder named ‘plugins’ in same directory as ‘bot.py’
default_plugins (bool) – Pass False to disable default plugins. Defaults to True.
set_menu (bool) – Pass False to disable menu. Defaults to True.
- static data(key: Optional[str] = None)
Returns a special dictionary with five keys.
Key
Returns
plugins
number of plugins in bot
plugins_list
list of plugins in bot
commands
number of commands in bot
commands_list
list of commands in bot
command_descriptions
command_descriptions dictionary if passed in
Stark.cmd
decorator- Parameters
key (str) – Return only one of the five keys from [“plugins”, “plugins_list”, “commands”, “commands_list”, “command_descriptions”]
Example
{"plugins": 2, "plugins_list": ["basic", "sample"], "commands": 5, "command_list": ["start", "help", "about", "id", "sample"]}, command_descriptions: {"start": "Start the bot"}
- static list_args(message: Union[pyrogram.types.messages_and_media.message.Message, str], split: str = ' ')
List arguments passed in a message. Removes first word (the command itself)
- Parameters
message – Pass a command message or message.text to get arguments passed in this message.
split (str) – How to split the arguments, Defaults to ‘ ‘.
Example: if text is “/start reply user”, reply would be [“reply”, “user”]