Skip to content

Commit d59bd5c

Browse files
committed
Modify invoke to support cog-based menu invocations.
1 parent 8dc2e52 commit d59bd5c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

discord_slash/model.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ async def invoke(self, *args, **kwargs):
206206
# to preventing needing different functions per object,
207207
# this function simply handles cogs
208208
if hasattr(self, "cog"):
209+
# print(self.func)
210+
if (
211+
str(self.func.__annotations__["ctx"])
212+
== "<class 'discord_slash.context.MenuContext'>"
213+
):
214+
# The idea is, since every command uses context, check the type of it.
215+
return await self.func(*args, **kwargs)
209216
return await self.func(self.cog, *args, **kwargs)
210217
return await self.func(*args, **kwargs)
211218

0 commit comments

Comments
 (0)