diff --git a/discord/cog.py b/discord/cog.py index 9e3d8733a4..6f6a573869 100644 --- a/discord/cog.py +++ b/discord/cog.py @@ -735,7 +735,7 @@ def _remove_module_references(self, name: str) -> None: self.remove_application_command(cmd) # remove all the listeners from the module - for event_list in self.extra_events.copy().values(): + for event_list in self._event_handlers.copy().values(): remove = [ index for index, event in enumerate(event_list) diff --git a/discord/ext/bridge/bot.py b/discord/ext/bridge/bot.py index c9baecb034..1d9a36f37d 100644 --- a/discord/ext/bridge/bot.py +++ b/discord/ext/bridge/bot.py @@ -120,7 +120,7 @@ def decorator(func) -> BridgeCommandGroup: async def invoke(self, ctx: ExtContext | BridgeExtContext): if ctx.command is not None: self.dispatch("command", ctx) - if br_cmd := isinstance(ctx.command, BridgeExtCommand): + if isinstance(ctx.command, BridgeExtCommand): self.dispatch("bridge_command", ctx) try: if await self.can_run(ctx, call_once=True): @@ -131,12 +131,12 @@ async def invoke(self, ctx: ExtContext | BridgeExtContext): await ctx.command.dispatch_error(ctx, exc) else: self.dispatch("command_completion", ctx) - if br_cmd: + if isinstance(ctx.command, BridgeExtCommand): self.dispatch("bridge_command_completion", ctx) elif ctx.invoked_with: exc = errors.CommandNotFound(f'Command "{ctx.invoked_with}" is not found') self.dispatch("command_error", ctx, exc) - if br_cmd: + if isinstance(ctx.command, BridgeExtCommand): self.dispatch("bridge_command_error", ctx, exc) async def invoke_application_command( diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index ae8a48c283..4f1753e49a 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -159,7 +159,7 @@ async def on_command_error( This only fires if you do not specify any listeners for command error. """ - if self.extra_events.get("on_command_error", None): + if self._event_handlers.get("on_command_error", None): return command = context.command