Skip to content

Commit

Permalink
fix: UnboundLocalError (#1928)
Browse files Browse the repository at this point in the history
* fix UnboundLocalError

Signed-off-by: Om <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Check if command is bridge command every time

Signed-off-by: Om <[email protected]>

---------

Signed-off-by: Om <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: BobDotCom <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2023
1 parent 71db6f6 commit 34a23eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions discord/ext/bridge/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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(
Expand Down

0 comments on commit 34a23eb

Please sign in to comment.