File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,22 @@ def cog(self) -> Cog | None:
345
345
346
346
return self .command .cog
347
347
348
+ def is_guild_integration (self ) -> bool :
349
+ """:class:`bool`: Returns ``True`` if the invoked command was guild installed.
350
+ This is a shortcut for :meth:`Interaction.is_guild_integration`.
351
+
352
+ .. versionadded:: 2.7
353
+ """
354
+ return self .interaction .is_guild_integration ()
355
+
356
+ def is_user_integration (self ) -> bool :
357
+ """:class:`bool`: Returns ``True`` if the invoked command was user installed.
358
+ This is a shortcut for :meth:`Interaction.is_user_integration`.
359
+
360
+ .. versionadded:: 2.7
361
+ """
362
+ return self .interaction .is_user_integration ()
363
+
348
364
349
365
class AutocompleteContext :
350
366
"""Represents context for a slash command's option autocomplete.
Original file line number Diff line number Diff line change @@ -360,6 +360,26 @@ def followup(self) -> Webhook:
360
360
}
361
361
return Webhook .from_state (data = payload , state = self ._state )
362
362
363
+ def is_guild_integration (self ) -> bool :
364
+ """:class:`bool`: Returns ``True`` if the interaction is a guild integration.
365
+
366
+ .. versionadded:: 2.7
367
+ """
368
+ if self .guild_id :
369
+ return self .authorizing_integration_owners .guild_id == self .guild_id
370
+ return False
371
+
372
+ def is_user_integration (self ) -> bool :
373
+ """:class:`bool`: Returns ``True`` if the interaction is a user integration.
374
+
375
+ .. versionadded:: 2.7
376
+ """
377
+ if self .user :
378
+ return self .authorizing_integration_owners .user_id == self .user .id
379
+
380
+ # This return should not be called but making sure it returns the expected value
381
+ return False
382
+
363
383
async def original_response (self ) -> InteractionMessage :
364
384
"""|coro|
365
385
You can’t perform that action at this time.
0 commit comments