From 315b3e5c98b71952d949818e0b35d8f72271eb6b Mon Sep 17 00:00:00 2001 From: Fixator10 Date: Thu, 21 Jan 2021 13:20:20 +0400 Subject: [PATCH] Add `on_red_before_identify` dispatch (#4647) * add before_identify_hook with `on_identify` dispatch * move before_identify_hook closer to other "hooks" * add `red_` prefix to avoid potential conflict * on_red_before_identify Co-authored-by: Fixator10 --- redbot/core/bot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redbot/core/bot.py b/redbot/core/bot.py index 1afcbd0ce..71f2ff590 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -384,6 +384,12 @@ class RedBase( self._red_before_invoke_objs.add(coro) return coro + async def before_identify_hook(self, shard_id, *, initial=False): + """A hook that is called before IDENTIFYing a session. + Same as in discord.py, but also dispatches "on_red_identify" bot event.""" + self.dispatch("red_before_identify", shard_id, initial) + return await super().before_identify_hook(shard_id, initial=initial) + @property def cog_mgr(self) -> NoReturn: raise AttributeError("Please don't mess with the cog manager internals.")