Data Manager

Data manager is a module that handles all the information necessary to bootstrap the bot into a state where more abstract data management systems can take over.

redbot.core.data_manager.bundled_data_path(cog_instance)[source]

Get the path to the “data” directory bundled with this cog.

The bundled data folder must be located alongside the .py file which contains the cog class.

Important

You should NEVER write to this directory.

Parameters

cog_instance – An instance of your cog. If calling from a command or method of your cog, this should be self.

Returns

Path object to the bundled data folder.

Return type

pathlib.Path

Raises

FileNotFoundError – If no bundled data folder exists.

redbot.core.data_manager.cog_data_path(cog_instance=None, raw_name=None)[source]

Gets the base cog data path. If you want to get the folder with which to store your own cog’s data please pass in an instance of your cog class.

Either cog_instance or raw_name will be used, not both.

Parameters
  • cog_instance – The instance of the cog you wish to get a data path for. If calling from a command or method of your cog, this should be self.

  • raw_name (str) – The name of the cog to get a data path for.

Returns

If cog_instance is provided it will return a path to a folder dedicated to a given cog. Otherwise it will return a path to the folder that contains data for all cogs.

Return type

pathlib.Path

redbot.core.data_manager.create_temp_config()[source]

Creates a default instance for Red, so it can be ran without creating an instance.

Warning

The data of this instance will be removed on next system restart.

redbot.core.data_manager.load_basic_configuration(instance_name_)[source]

Loads the basic bootstrap configuration necessary for Config to know where to store or look for data.

Important

It is necessary to call this function BEFORE getting any Config objects!

Parameters

instance_name (str) – The instance name given by CLI argument and created during redbot setup.

redbot.core.data_manager.storage_details()[source]

Gets any details necessary for config drivers to load.

These are set on setup.

Returns

Storage details.

Return type

dict

redbot.core.data_manager.storage_type()[source]

Gets the storage type as a string.

Returns

Storage type.

Return type

str