Interaction Model¶
Note
The following classes come from the scurrypy.models.interaction module.
InteractionModel
dataclass
¶
Bases: DataModel
Represents the interaction model.
type: int
instance-attribute
¶
Type of interaction.
See InteractionTypes.
id: int
instance-attribute
¶
ID of interaction.
token: str
instance-attribute
¶
token of interaction.
channel_id: int
instance-attribute
¶
ID of the channel where the interaction was sent.
application_id: int
instance-attribute
¶
ID of the application that owns the interaction.
app_permissions: int
instance-attribute
¶
Bitwise set of permissions pertaining to the location of the interaction. [INT_LIMIT]
member: GuildMemberModel
instance-attribute
¶
Guild member invoking the interaction.
message: Optional[MessageModel]
instance-attribute
¶
Message associated with interaction (components or modals).
locale: str
instance-attribute
¶
Invoking user's locale.
guild_locale: str
instance-attribute
¶
Locale of the guild the interaction was invoked (if invoked in a guild).
guild_id: Optional[int]
instance-attribute
¶
ID of guild the interaction was invoked (if invoked in a guild).
guild: Optional[GuildModel]
instance-attribute
¶
Partial guild object of the guild the interaction was invoked (if invoked in a guild).
channel: Optional[ChannelModel]
instance-attribute
¶
Partial channel object the interaction was invoked.
bot_can
¶
Checks app_permissions to see if permission bit is toggled.
Parameters:
-
permission_bit(int) –permission bit. See Permissions.
Returns:
-
bool–whether the bot has this permission
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
InteractionTypes
¶
Interaction types constants.
APPLICATION_COMMAND = 2
class-attribute
instance-attribute
¶
Slash command interaction.
MESSAGE_COMPONENT = 3
class-attribute
instance-attribute
¶
Message component interaction (e.g., button, select menu, etc.).
APPLICATION_COMMAND_AUTOCOMPLETE = 4
class-attribute
instance-attribute
¶
Application command autocompletion.
MODAL_SUBMIT = 5
class-attribute
instance-attribute
¶
Modal submit interaction.
InteractionCallbackModel
dataclass
¶
Bases: DataModel
Represents the interaction callback response object.
InteractionCallbackDataModel
dataclass
¶
Bases: DataModel
Represents the interaction callback object.
id: int
instance-attribute
¶
ID of the interaction.
type: int
instance-attribute
¶
Type of interaction.
See InteractionCallbackTypes.
activity_instance_id: str
instance-attribute
¶
Instance ID of activity if an activity was launched or joined.
response_message_id: int
instance-attribute
¶
ID of the message created by the interaction.
response_message_loading: bool
instance-attribute
¶
If the interaction is in a loading state.
response_message_ephemeral: bool
instance-attribute
¶
If the interaction is ephemeral.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
InteractionCallbackTypes
¶
Interaction callback types constants.
PONG = 1
class-attribute
instance-attribute
¶
Acknowledge a Ping.
CHANNEL_MESSAGE_WITH_SOURCE = 4
class-attribute
instance-attribute
¶
Respond to an interaction with a message.
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5
class-attribute
instance-attribute
¶
Acknowledge an interaction and edit a response later. User sees a loading state.
DEFERRED_UPDATE_MESSAGE = 6
class-attribute
instance-attribute
¶
Acknowledge an interaction and edit the original message later. The user does NOT see a loading state. (Components only)
UPDATE_MESSAGE = 7
class-attribute
instance-attribute
¶
Edit the message in which the component was attached.
APPLICATION_COMMAND_AUTOCOMPLETE_RESULT = 8
class-attribute
instance-attribute
¶
Respond to an autocomplete interaction with suggested choices.
MODAL = 9
class-attribute
instance-attribute
¶
Respond to an interaction with a popup modal (not available for MODAL_SUBMIT and PING interactions).
LAUNCH_ACTIVITY = 12
class-attribute
instance-attribute
¶
Launch an activity associated with the app (Activities must be enabled).
InteractionDataTypes
¶
Interaction data types constants.