pytdbot.types.plugins

class pytdbot.types.plugins.Plugins(folder, include=None, exclude=None)[source]

Bases: object

Load and filter plugins from a folder

Parameters:
  • folder (str)

  • include (list)

  • exclude (list)

__init__(folder, include=None, exclude=None)[source]
Parameters:
  • folder (str) – The folder to load plugins from

  • include (list, optional) – Only load plugins with names in this list

  • exclude (list, optional) – Exclude plugins with names in this list

Return type:

None

Example

To load only the plugins with path “plugins/rules.py” and “plugins/subfolder1/commands.py”, you should create the Plugins object like this:

>>> plugins = Plugins(
        folder="plugins/",
        include=[
            "rules" # will be translated to "plugins.rules"
            "subfolder1.commands" # -> plugins.subfolder1.commands
        ]
    )
Raises:

TypeError

Parameters:
  • folder (str)

  • include (list | None)

  • exclude (list | None)

Return type:

None