Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document prefix preservation #4085

Merged
merged 6 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/version_guarantees.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ which is not private (even if not documented) should not break without notice.
Anything in the ``redbot.cogs`` and ``redbot.vendored`` modules or any of their submodules is specifically
excluded from being guaranteed.

Method names and names of attributes of classes, functions, extensions, and modules
provided by or provided to the bot should not begin with
``red_`` or be of the form ``__red_*__`` except as documented.
This allows us to add certain optional features non-breakingly without a name conflict.

Any RPC method exposed by Red may break without notice.

If you would like something in here to be guaranteed,
Expand Down
25 changes: 24 additions & 1 deletion redbot/core/commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ class Command(CogCommandMixin, DPYCommand):
attributes listed below are simply additions to the ones listed
with that class.

.. warning::

If you subclass this command, attributes and methods
must remain compatible.

None of your methods should start with ``red_`` or
be dunder names which start with red (eg. ``__red_test_thing__``)
unless to override behavior in a method designed to be overriden,
as this prefix is reserved for future methods in order to be
able to add features non-breakingly.

Attributes
----------
checks : List[`coroutine function`]
Expand Down Expand Up @@ -657,7 +668,7 @@ def format_shortdoc_for_context(self, ctx: "Context") -> str:

See ``format_text_for_context`` for the actual implementation details

Cog creators may override this in their own command classes
Cog creators may override this in their own command and cog classes
as long as the method signature stays the same.

Parameters
Expand Down Expand Up @@ -864,6 +875,18 @@ class Cog(CogMixin, DPYCog, metaclass=DPYCogMeta):
Red's Cog base class

This includes a metaclass from discord.py

.. warning::

None of your methods should start with ``red_`` or
be dunder names which start with red (eg. ``__red_test_thing__``)
unless to override behavior in a method designed to be overriden,
as this prefix is reserved for future methods in order to be
able to add features non-breakingly.

Attributes and methods must remain compatible
with discord.py and with any of red's methods and attributes.

"""

__cog_commands__: Tuple[Command]
Expand Down