utils Module

utils Module

class utils.PythonPathContext(path_to_add)[source]

Bases: object

utils.all_possible_beards(paths)[source]

List generator of all plug-ins that Skybeard has found and can be loaded

utils.contains_setup_beard_py(path)[source]

Checks if path contains setup_beard.py.

utils.embolden(string)[source]

wraps a string in bold tags

utils.getMe()[source]
utils.get_args(msg_or_text, return_string=False, **kwargs)[source]

Helper function when the command used in the telegram chat may have arguments, e.g /command arg1 arg2. Returns a list of any arguments found after the command

utils.get_beard_config(config_file='../../config.yml')[source]

Attempts to load a yaml file in the beard directory.

NOTE: The file location should be relative from where this function is called.

utils.get_literal_beard_paths(beard_paths)[source]

Returns list of literal beard paths.

utils.get_literal_path(path_or_autoloader)[source]

Gets literal path from AutoLoader or returns input.

utils.is_module(path)[source]

Checks if path is a module.

utils.is_namespace_module(mod)[source]

Check is the given module is a namespace module.

utils.italisize(string)[source]

wraps a string in italic tags

utils.partition_text(text)[source]

Generator for splitting long texts into ones below the character limit. Messages are split at the nearest line break and each successive chunk is yielded. Relatively untested

utils.setup_beard(beard_module_name, *, beard_python_path='python', beard_requirements_file='requirements.txt', config_file='config.yml', example_config_file='config.yml.example', copy_config=False)[source]

Sets up a beard for use.

Note: beard_python_path must be a path relative to the file setup_beard is called from.