Skip to content

Commit 418b9cb

Browse files
committed
Add modifications
1 parent 0e016be commit 418b9cb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

discord/ext/commands/bot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ async def process_commands(self, message: Message, /) -> None:
13991399

14001400
ctx = await self.get_context(message)
14011401
# the type of the invocation context's bot attribute will be correct
1402-
await self.invoke(ctx) # type: ignore
1402+
return await self.invoke(ctx) # type: ignore ###
14031403

14041404
async def on_message(self, message: Message, /) -> None:
14051405
await self.process_commands(message)

discord/ext/commands/core.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ async def invoke(self, ctx: Context[BotT], /) -> None:
10261026
ctx.invoked_subcommand = None
10271027
ctx.subcommand_passed = None
10281028
injected = hooked_wrapped_callback(self, ctx, self.callback) # type: ignore
1029-
await injected(*ctx.args, **ctx.kwargs) # type: ignore
1029+
return await injected(*ctx.args, **ctx.kwargs) # type: ignore ###
10301030

10311031
async def reinvoke(self, ctx: Context[BotT], /, *, call_hooks: bool = False) -> None:
10321032
ctx.command = self
@@ -1641,18 +1641,20 @@ async def invoke(self, ctx: Context[BotT], /) -> None:
16411641

16421642
if early_invoke:
16431643
injected = hooked_wrapped_callback(self, ctx, self.callback) # type: ignore
1644-
await injected(*ctx.args, **ctx.kwargs) # type: ignore
1644+
result = await injected(*ctx.args, **ctx.kwargs) # type: ignore ###
1645+
if result:
1646+
return result
16451647

16461648
ctx.invoked_parents.append(ctx.invoked_with) # type: ignore
16471649

16481650
if trigger and ctx.invoked_subcommand:
16491651
ctx.invoked_with = trigger
1650-
await ctx.invoked_subcommand.invoke(ctx)
1652+
return await ctx.invoked_subcommand.invoke(ctx) ###
16511653
elif not early_invoke:
16521654
# undo the trigger parsing
16531655
view.index = previous
16541656
view.previous = previous
1655-
await super().invoke(ctx)
1657+
return await super().invoke(ctx) ###
16561658

16571659
async def reinvoke(self, ctx: Context[BotT], /, *, call_hooks: bool = False) -> None:
16581660
ctx.invoked_subcommand = None

0 commit comments

Comments
 (0)