Response

discord_http.response module

class discord_http.response.AutocompleteResponse(choices)

Bases: BaseResponse

Represents an autocomplete response.

Parameters:

choices (dict[Any, str]) – A dictionary of choices for the autocomplete response. The keys are the values to be sent to Discord, and the values are the names to be displayed to the user.

to_dict() dict

Returns the response as a dict.

Return type:

dict

to_multipart() bytes

Returns the response as a bytes.

Return type:

bytes

class discord_http.response.DeferResponse(*, ephemeral=False, thinking=False, flags=None)

Bases: BaseResponse

Represents a response that defers the interaction.

Parameters:
  • ephemeral (bool) – Whether the response is ephemeral or not.

  • thinking (bool) – Whether the response is thinking or not.

  • flags (MessageFlags) – The flags for the response.

to_dict() dict

Returns the response as a dict.

Return type:

dict

to_multipart() bytes

Returns the response as a bytes.

Return type:

bytes

class discord_http.response.MessageResponse(content=<MISSING>, *, file=<MISSING>, files=<MISSING>, embed=<MISSING>, embeds=<MISSING>, attachment=<MISSING>, attachments=<MISSING>, view=<MISSING>, tts=False, allowed_mentions=<MISSING>, message_reference=<MISSING>, poll=<MISSING>, type=4, ephemeral=False, flags=<MISSING>)

Bases: BaseResponse

Represents a message response.

Parameters:
  • content (str | None) – The content of the message.

  • file (File | None) – A single file to be sent with the message.

  • files (list[File] | None) – A list of files to be sent with the message.

  • embed (Embed | None) – A single embed to be sent with the message.

  • embeds (list[Embed] | None) – A list of embeds to be sent with the message.

  • attachment (File | None) – A single attachment to be sent with the message.

  • attachments (list[File] | None) – A list of attachments to be sent with the message.

  • view (View | None) – A view to be sent with the message.

  • tts (bool | None) – Whether the message should be sent as a TTS message.

  • allowed_mentions (AllowedMentions | None) – Allowed mentions for the message.

  • message_reference (MessageReference | None) – A reference to another message, if applicable.

  • poll (Poll | None) – A poll to be sent with the message.

  • type (ResponseType | int) – The type of the response. Defaults to ResponseType.message.

  • ephemeral (bool | None) – Whether the message should be ephemeral or not.

  • flags (MessageFlags | None) – Flags for the message response.

to_dict(is_request=False) dict

The JSON data that is sent to Discord.

Parameters:

is_request (bool) – Whether the data is being sent to Discord or not.

Return type:

dict

Returns:

The JSON data that can either be sent to Discord or forwarded to a new parser

to_multipart(is_request=False) bytes

The multipart data that is sent to Discord.

Parameters:

is_request (bool) – Whether the data is being sent to Discord or not.

Return type:

bytes

Returns:

The multipart data that can either be sent

class discord_http.response.Ping(*, state, data)

Bases: Snowflake

Represents a ping response from the Discord API.

Usually reserved for internal use.

Parameters:
application_id

The ID of the application that created the ping.

Type:

int

version

The version of the ping.

Type:

int

property application: PartialUser

Returns the user object of the bot.

property user: User

Returns the user object of the bot.