aboutsummaryrefslogtreecommitdiff
path: root/docs/migrating.rst
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-02-23 04:26:03 -0500
committerRapptz <[email protected]>2019-02-23 04:26:03 -0500
commita8dd4a826f66a9e118f7956922ec4e2c34b42ba6 (patch)
tree6059bb8b70f95c51eebfc9b629d044a5a1a24589 /docs/migrating.rst
parentRework entire cog system and partially document it and extensions. (diff)
downloaddiscord.py-a8dd4a826f66a9e118f7956922ec4e2c34b42ba6.tar.xz
discord.py-a8dd4a826f66a9e118f7956922ec4e2c34b42ba6.zip
Document listener changes in the migrating docs.
Diffstat (limited to 'docs/migrating.rst')
-rw-r--r--docs/migrating.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/migrating.rst b/docs/migrating.rst
index 9fc8d72a..bf468f51 100644
--- a/docs/migrating.rst
+++ b/docs/migrating.rst
@@ -956,6 +956,8 @@ Cogs are now required to have a base class, :class:`~.commands.Cog` for future p
* :meth:`.Cog.cog_before_invoke` and :meth:`.Cog.cog_after_invoke`
- A special method that registers a cog before and after invoke hook. More information can be found in :ref:`migrating_1_0_before_after_hook`.
+Those that were using listeners, such as ``on_message`` inside a cog will now have to explicitly mark them as such using the :meth:`.commands.Cog.listener` decorator.
+
Along with that, cogs have gained the ability to have custom names through specifying it in the class definition line. More options can be found in the metaclass that facilitates all this, :class:`.commands.CogMeta`.
An example cog with every special method registered and a custom name is as follows:
@@ -987,6 +989,10 @@ An example cog with every special method registered and a custom name is as foll
async def cog_after_invoke(self, ctx):
print('cog local after: {0.command.qualified_name}'.format(ctx))
+ @commands.Cog.listener()
+ async def on_message(self, message):
+ pass
+
.. _migrating_1_0_before_after_hook: