Skip to content

Incoming Objects

IncomingDiscordInteraction is a helper object that is passed to every handler argument (ctx).

It allows you to view context from the command/button/menu from where it was sent and by who. It's recommended to read the Discord documentation to learn more about what data is returned.

Info

If you want to change the keyword argument name in where the context will be passed to, you can pass custom_context_argument_name to Dispike.

attribute_helpers special

resolved_interactions

resolved_interactions_finder(cls, query, type_to_determine)

Finds all interactions that are resolved.

:param query: The query to search for. :param type_to_determine: The type of interaction to search for. :return: A list of all interactions that are resolved.

Source code in dispike/incoming/attribute_helpers/resolved_interactions.py
@logger.catch(reraise=True, message="Unable to lookup query for resolve")
def resolved_interactions_finder(
    cls: "IncomingDiscordSlashInteraction",
    query: typing.Union[str, int],
    type_to_determine: str,
) -> typing.Union[PartialMember, None]:
    """
    Finds all interactions that are resolved.

    :param query: The query to search for.
    :param type_to_determine: The type of interaction to search for.
    :return: A list of all interactions that are resolved.
    """
    _grab_member = cls.data.resolved[type_to_determine].get(query, None)
    if _grab_member is not None:
        return _class_return[type_to_determine](**_grab_member)
    return _grab_member

discord_types special

channel

ChannelTypes

An enumeration.

PartialChannel pydantic-model

A partial representation for a discord channel. This is found in a Application Command Interaction Data Resolved Structure

Partial Channel objects only have id, name, type and permissions attributes.

member

Member pydantic-model

A representation of a discord member, intended for you to easily access attributes. this is not intended for you to edit, and will not be accepted as an argument in any function.

PartialMember pydantic-model

A partial representation for a discord user. This is found in a Application Command Interaction Data Resolved Structure

Partial Member objects are missing user, deaf and mute attributes.

message

Message pydantic-model

A representation of a discord message, intended for you to easily access attributes. this is not intended for you to edit, and will not be accepted as an argument in any function.

MessageAttachment pydantic-model

A message attachment

user

User pydantic-model

A representation of a User object from discord. this is not intended for you to edit, and will not be accepted as an argument in any function.

incoming_interactions

IncomingApplicationCommand pydantic-model

An Incoming Application command, this is not intended for you to edit, and will not be accepted in any function

Attributes:

Name Type Description
id int

Id of the interaction.

application_id int

The id of your bot.

name int

Name of the command.

description int

Description of the command.

options Union[List[CommandOption], List[SubcommandOption]]

Selected options from the command.

default_permission bool

Bool whether if uses default permissions.

IncomingDiscordButtonData pydantic-model

Incoming button data.

Attributes:

Name Type Description
custom_id str

The custom id of this button.

IncomingDiscordButtonInteraction pydantic-model

An incoming discord interaction that was triggered by a button press, this is not intended for you to edit, and will not be accepted as an argument in any function.

Attributes:

Name Type Description
id int

Id of the interaction.

data IncomingDiscordButtonData

Data from the interaction.

guild_id int

Guild ID where this happened.

channel_id int

Channel ID where this happened.

member Member

TODO: IDK if this is the member that called the command originally or the one that used the button.

token str

Token of this interaction.

IncomingDiscordMessageCommandData pydantic-model

Incoming message command data.

Attributes:

Name Type Description
target_id str

The id of the targeted message.

target Message

The target message.

name str

The name of the message command.

IncomingDiscordMessageCommandInteraction pydantic-model

An incoming discord interaction that was triggered by a message command interaction, this is not intended for you to edit, and will not be accepted as an argument in any function.

Attributes:

Name Type Description
id int

Id of the interaction.

data IncomingDiscordMessageCommandData

Data from the interaction.

guild_id int

Guild ID where this happened.

channel_id int

Channel ID where this happened.

member Member

Member that called the command.

token str

Token of this interaction.

IncomingDiscordOption pydantic-model

An incoming discord option, this is not intended for you to edit, and will not be accepted as an argument in any function nor will be accepted as a value in DiscordCommand

Attributes:

Name Type Description
name str

Name of the option

value str

Value of the option

IncomingDiscordSelectMenuData pydantic-model

Incoming select menu data.

Attributes:

Name Type Description
custom_id str

The custom id of this button.

values List[str]

A list of string values that the user selected.

IncomingDiscordSelectMenuInteraction pydantic-model

An incoming discord interaction that was triggered by a select menu interaction, this is not intended for you to edit, and will not be accepted as an argument in any function.

Attributes:

Name Type Description
id int

Id of the interaction.

data IncomingDiscordSelectMenuData

Data from the interaction.

guild_id int

Guild ID where this happened.

channel_id int

Channel ID where this happened.

member Member

TODO: IDK if this is the member that called the command originally or the one that used the select menu.

token str

Token of this interaction.

IncomingDiscordSlashData pydantic-model

An incoming discord option list, this is not intended for you to edit, and will not be accepted as an argument in any function nor accepted in DiscordCommand

Attributes:

Name Type Description
id str

Id of the command

name str

Name of the command

options Union[List[IncomingDiscordOption], List[SubcommandIncomingDiscordOptionList]]

Options selected by the user

IncomingDiscordSlashInteraction pydantic-model

An incoming discord interaction that was triggered by a command, this is not intended for you to edit, and will not be accepted as an argument in any function.

Attributes:

Name Type Description
id int

Id of the interaction.

data IncomingDiscordSlashData

Options from the command.

guild_id int

Guild ID where this happened.

channel_id int

Channel ID where this happened.

member Member

Member that used this interaction.

token str

Token of this interaction.

IncomingDiscordUserCommandData pydantic-model

Incoming user command data.

Attributes:

Name Type Description
target_id str

The id of the targeted user.

target Member

The targeted member.

name str

The name of the user command.

IncomingDiscordUserCommandInteraction pydantic-model

An incoming discord interaction that was triggered by a user command interaction, this is not intended for you to edit, and will not be accepted as an argument in any function.

Attributes:

Name Type Description
id int

Id of the interaction.

data IncomingDiscordUserCommandData

Data from the interaction.

guild_id int

Guild ID where this happened.

channel_id int

Channel ID where this happened.

member Member

Member that called the command.

token str

Token of this interaction.

SubcommandIncomingDiscordOptionList pydantic-model

An incoming discord option list, this is not intended for you to edit, and will not be accepted as an argument in any function nor accepted in DiscordCommand

Attributes:

Name Type Description
name str

Name of the subcommand

options Union[List[IncomingDiscordOption], List[SubcommandIncomingDiscordOptionListChild]]

Options selected by the user

SubcommandIncomingDiscordOptionListChild pydantic-model

Attributes:

Name Type Description
name str

Name of the subcommand

options List[IncomingDiscordOption]]

Options selected by the user