mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
[Docs] Copy over config docs from red-api-docs (#899)
* Update config.Config docs * Set group docstrings * Update Value docs
This commit is contained in:
@@ -1,17 +1,45 @@
|
||||
.. config shite
|
||||
|
||||
.. role:: python(code)
|
||||
:language: python
|
||||
|
||||
======
|
||||
Config
|
||||
======
|
||||
|
||||
===========
|
||||
Config was introduced in V3 as a way to make data storage easier and safer for all developers regardless of skill level.
|
||||
It will take some getting used to as the syntax is entirely different from what Red has used before, but we believe
|
||||
Config will be extremely beneficial to both cog developers and end users in the long run.
|
||||
|
||||
***********
|
||||
Basic Usage
|
||||
===========
|
||||
***********
|
||||
|
||||
Stuff goes here
|
||||
.. code-block:: python
|
||||
|
||||
=============
|
||||
from core import Config
|
||||
|
||||
class MyCog:
|
||||
def __init__(self):
|
||||
self.config = Config.get_conf(self, identifier=1234567890)
|
||||
|
||||
self.config.register_global(
|
||||
foo=True
|
||||
)
|
||||
|
||||
@commands.command()
|
||||
async def return_some_data(self, ctx):
|
||||
await ctx.send(config.foo())
|
||||
|
||||
*************
|
||||
API Reference
|
||||
=============
|
||||
*************
|
||||
|
||||
.. important::
|
||||
|
||||
Before we begin with the nitty gritty API Reference, you should know that there are tons of working code examples
|
||||
inside the bot itself! Simply take a peek inside of the :code:`tests/core/test_config.py` file for examples of using
|
||||
Config in all kinds of ways.
|
||||
|
||||
.. automodule:: core.config
|
||||
|
||||
@@ -20,13 +48,21 @@ API Reference
|
||||
|
||||
.. autoclass:: Group
|
||||
:members:
|
||||
:special-members:
|
||||
|
||||
.. autoclass:: MemberGroup
|
||||
:members:
|
||||
|
||||
.. autoclass:: Value
|
||||
:members:
|
||||
:special-members: __call__
|
||||
|
||||
|
||||
================
|
||||
****************
|
||||
Driver Reference
|
||||
================
|
||||
****************
|
||||
|
||||
.. automodule:: core.drivers
|
||||
|
||||
.. autoclass:: red_base.BaseDriver
|
||||
:members:
|
||||
|
||||
Reference in New Issue
Block a user