Data Manager

Data manager was introduced as a new feature in V3 as a way to move all of the bot’s data out of the source code files. This was an important step towards making the bot pip installable.

Basic Usage

from core.data_manager import cog_data_path

class MyCog:
    def __init__(self):
        self.my_data_path = cog_data_path(self)

API Reference

core.data_manager.load_basic_configuration(path)

Loads the basic configuration necessary for config to work.

Parameters:path (pathlib.Path) – Path pointing to the basic configuration file.
core.data_manager.cog_data_path([cog_instance=None])

This will return a path-like object to the directory to which a cog is allowed to write its own data.

Note

If cog instance is not provided it will return a path-like object pointing to the folder containing all cog data.

Parameters:cog_instance (Optional) – An instantiated cog object.
Returns:A path-like object.
Return type:pathlib.Path
core.data_manager.core_data_path()

This will return a path-like object to the directory to which core cogs are allowed to write data.

Returns:A path-like object.
Return type:pathlib.Path