3434from ..member import Member
3535from ..user import User
3636from ..message import Message
37- from .context import InteractionContext
37+ from .context import ApplicationContext
3838from ..utils import find , get_or_fetch , async_all
3939from ..errors import DiscordException , NotFound , ValidationError , ClientException
4040from .errors import ApplicationCommandError , CheckFailure , ApplicationCommandInvokeError
@@ -104,7 +104,7 @@ def __repr__(self):
104104 def __eq__ (self , other ):
105105 return isinstance (other , self .__class__ )
106106
107- async def prepare (self , ctx : InteractionContext ) -> None :
107+ async def prepare (self , ctx : ApplicationContext ) -> None :
108108 # This should be same across all 3 types
109109 ctx .command = self
110110
@@ -116,13 +116,13 @@ async def prepare(self, ctx: InteractionContext) -> None:
116116 await self .call_before_hooks (ctx )
117117 pass
118118
119- async def invoke (self , ctx : InteractionContext ) -> None :
119+ async def invoke (self , ctx : ApplicationContext ) -> None :
120120 await self .prepare (ctx )
121121
122122 injected = hooked_wrapped_callback (self , ctx , self ._invoke )
123123 await injected (ctx )
124124
125- async def can_run (self , ctx : InteractionContext ) -> bool :
125+ async def can_run (self , ctx : ApplicationContext ) -> bool :
126126
127127 if not await ctx .bot .can_run (ctx ):
128128 raise CheckFailure (f'The global check functions for command { self .name } failed.' )
@@ -134,7 +134,7 @@ async def can_run(self, ctx: InteractionContext) -> bool:
134134
135135 return await async_all (predicate (ctx ) for predicate in predicates ) # type: ignore
136136
137- async def dispatch_error (self , ctx : InteractionContext , error : Exception ) -> None :
137+ async def dispatch_error (self , ctx : ApplicationContext , error : Exception ) -> None :
138138 ctx .command_failed = True
139139 cog = self .cog
140140 try :
@@ -233,7 +233,7 @@ def after_invoke(self, coro):
233233 self ._after_invoke = coro
234234 return coro
235235
236- async def call_before_hooks (self , ctx : InteractionContext ) -> None :
236+ async def call_before_hooks (self , ctx : ApplicationContext ) -> None :
237237 # now that we're done preparing we can call the pre-command hooks
238238 # first, call the command local hook:
239239 cog = self .cog
@@ -258,7 +258,7 @@ async def call_before_hooks(self, ctx: InteractionContext) -> None:
258258 if hook is not None :
259259 await hook (ctx )
260260
261- async def call_after_hooks (self , ctx : InteractionContext ) -> None :
261+ async def call_after_hooks (self , ctx : ApplicationContext ) -> None :
262262 cog = self .cog
263263 if self ._after_invoke is not None :
264264 instance = getattr (self ._after_invoke , '__self__' , cog )
@@ -391,7 +391,7 @@ def __eq__(self, other) -> bool:
391391 and other .description == self .description
392392 )
393393
394- async def _invoke (self , ctx : InteractionContext ) -> None :
394+ async def _invoke (self , ctx : ApplicationContext ) -> None :
395395 # TODO: Parse the args better, apply custom converters etc.
396396 kwargs = {}
397397 for arg in ctx .interaction .data .get ("options" , []):
@@ -570,7 +570,7 @@ def command_group(self, name, description) -> SlashCommandGroup:
570570 self .subcommands .append (sub_command_group )
571571 return sub_command_group
572572
573- async def _invoke (self , ctx : InteractionContext ) -> None :
573+ async def _invoke (self , ctx : ApplicationContext ) -> None :
574574 option = ctx .interaction .data ["options" ][0 ]
575575 command = find (lambda x : x .name == option ["name" ], self .subcommands )
576576 ctx .interaction .data = option
@@ -661,7 +661,7 @@ def __new__(cls, *args, **kwargs) -> UserCommand:
661661 self .__original_kwargs__ = kwargs .copy ()
662662 return self
663663
664- async def _invoke (self , ctx : InteractionContext ) -> None :
664+ async def _invoke (self , ctx : ApplicationContext ) -> None :
665665 if "members" not in ctx .interaction .data ["resolved" ]:
666666 _data = ctx .interaction .data ["resolved" ]["users" ]
667667 for i , v in _data .items ():
@@ -736,7 +736,7 @@ def __new__(cls, *args, **kwargs) -> MessageCommand:
736736 self .__original_kwargs__ = kwargs .copy ()
737737 return self
738738
739- async def _invoke (self , ctx : InteractionContext ):
739+ async def _invoke (self , ctx : ApplicationContext ):
740740 _data = ctx .interaction .data ["resolved" ]["messages" ]
741741 for i , v in _data .items ():
742742 v ["id" ] = int (i )
0 commit comments