mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Docstring fixes for dev env values (#4747)
* Docstring change for add_dev_env_value * Same for remove_dev_env_value
This commit is contained in:
parent
9b97244f9f
commit
cc885090e6
@ -287,22 +287,23 @@ class RedBase(
|
|||||||
Add a custom variable to the dev environment (``[p]debug``, ``[p]eval``, and ``[p]repl`` commands).
|
Add a custom variable to the dev environment (``[p]debug``, ``[p]eval``, and ``[p]repl`` commands).
|
||||||
If dev mode is disabled, nothing will happen.
|
If dev mode is disabled, nothing will happen.
|
||||||
|
|
||||||
.. admonition:: Example
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
class MyCog(commands.Cog):
|
class MyCog(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
bot.add_dev_env_value("mycog", lambda ctx: self)
|
bot.add_dev_env_value("mycog", lambda ctx: self)
|
||||||
bot.add_dev_env_value("mycogdata", lambda ctx: self.settings[ctx.guild.id])
|
bot.add_dev_env_value("mycogdata", lambda ctx: self.settings[ctx.guild.id])
|
||||||
|
|
||||||
def cog_unload(self):
|
def cog_unload(self):
|
||||||
self.bot.remove_dev_env_value("mycog")
|
self.bot.remove_dev_env_value("mycog")
|
||||||
self.bot.remove_dev_env_value("mycogdata")
|
self.bot.remove_dev_env_value("mycogdata")
|
||||||
|
|
||||||
Once your cog is loaded, the custom variables ``mycog`` and ``mycogdata``
|
Once your cog is loaded, the custom variables ``mycog`` and ``mycogdata``
|
||||||
will be included in the environment of dev commands.
|
will be included in the environment of dev commands.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -312,8 +313,8 @@ class RedBase(
|
|||||||
The function returning the value of the variable.
|
The function returning the value of the variable.
|
||||||
It must take a `commands.Context` as its sole parameter
|
It must take a `commands.Context` as its sole parameter
|
||||||
|
|
||||||
Raise
|
Raises
|
||||||
-----
|
------
|
||||||
TypeError
|
TypeError
|
||||||
``value`` argument isn't a callable.
|
``value`` argument isn't a callable.
|
||||||
ValueError
|
ValueError
|
||||||
@ -357,8 +358,8 @@ class RedBase(
|
|||||||
name: str
|
name: str
|
||||||
The name of the custom variable.
|
The name of the custom variable.
|
||||||
|
|
||||||
Raise
|
Raises
|
||||||
-----
|
------
|
||||||
KeyError
|
KeyError
|
||||||
The custom variable was never set.
|
The custom variable was never set.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user