Utilitas

ehforwarderbot.utils.extra(name, desc)[sumber]

Decorator for slave channel's "additional features" interface.

Parameter
  • name (str) -- A human readable name for the function.

  • desc (str) -- A short description and usage of it. Use {function_name} in place of the function name in the description.

Return type

Callable[..., Optional[str]]

Kembali

The decorated method.

Contoh

@extra(name="Echo", desc="Return the text entered.\n\nUsage:\n    {function_name} text")
def echo(self, text: str) -> Optional[str]:
    return text
ehforwarderbot.utils.get_base_path()[sumber]

Get the base data path for EFB. This can be defined by the environment variable EFB_DATA_PATH.

If EFB_DATA_PATH is not defined, this gives ~/.ehforwarderbot.

This method creates the queried path if not existing.

Return type

Path

Kembali

The base path.

ehforwarderbot.utils.get_config_path(module_id=None, ext='yaml')[sumber]

Get path for configuration file. Defaulted to ~/.ehforwarderbot/profiles/profile_name/module_id/config.yaml.

This method creates the queried path if not existing. The config file will not be created, however.

Parameter
  • module_id (Optional[NewType()(ModuleID, str)]) -- Module ID.

  • ext (str) -- Extension name of the config file. Defaulted to "yaml".

Return type

Path

Kembali

The path to the configuration file.

ehforwarderbot.utils.get_custom_modules_path()[sumber]

Get the path to custom channels

Return type

Path

Kembali

The path for custom channels.

ehforwarderbot.utils.get_data_path(module_id)[sumber]

Get the path for permanent storage of a module.

This method creates the queried path if not existing.

Parameter

module_id (NewType()(ModuleID, str)) -- Module ID

Return type

Path

Kembali

The data path of indicated module.

ehforwarderbot.utils.locate_module(module_id, module_type=None)[sumber]

Locate module by module ID

Parameter
  • module_id (NewType()(ModuleID, str)) -- Module ID

  • module_type (Optional[str]) -- Type of module, one of 'master', 'slave' and 'middleware'