dico.http.request module

class dico.http.request.HTTPRequest(token, default_retry=3)

Bases: HTTPRequestBase

request(route, meth, body=None, *, is_json=False, reason_header=None, retry=3, **kwargs)

This function includes requesting REST API. :return: Response.

create_message_with_files(channel_id, content=None, files=None, nonce=None, tts=None, embeds=None, allowed_mentions=None, message_reference=None, components=None, sticker_ids=None, attachments=None)

Sends create message request with files.

Parameters:
  • channel_id – ID of the channel.

  • content – Content of the message.

  • files – Files of the message.

  • nonce

  • tts – Whether this message is TTS.

  • embeds – List of embeds of the message.

  • allowed_mentions – Allowed mentions of the message.

  • message_reference – Message to reference.

  • components – Components of the message.

  • sticker_ids – List of ID of the stickers.

  • attachments – List of attachment objects.

edit_message_with_files(channel_id, message_id, content=Empty, embeds=Empty, flags=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)

Sends edit message request with files.

Parameters:
  • channel_id – ID of the channel.

  • message_id – ID of the message to edit.

  • content – Content of the message.

  • embeds – List of embeds of the message.

  • flags – Flags of the message.

  • files – Files of the message.

  • allowed_mentions – Allowed mentions of the message.

  • attachments – Attachments to keep.

  • components – Components of the message.

Returns:

Message object dict.

create_guild_sticker(guild_id, name, description, tags, file, reason=None)

Sends create guild sticker request.

Parameters:
  • guild_id – ID of the guild.

  • name – Name of the sticker.

  • description – Description of the sticker.

  • tags – Autocomplete text.

  • file – Sticker file to upload. Max 500 KB.

  • reason – Reason of the action.

execute_webhook_with_files(webhook_id, webhook_token, wait=None, thread_id=None, content=None, username=None, avatar_url=None, tts=False, files=None, embeds=None, allowed_mentions=None, components=None, attachments=None, flags=None)

Sends execute webhook request with files.

Parameters:
  • webhook_id – ID of the webhook.

  • webhook_token – Token of the webhook.

  • wait – Whether to wait response of the server.

  • thread_id – ID of the thread.

  • content – Content of the message.

  • username – Name of the webhook.

  • avatar_url – URL of the avatar image.

  • tts – Whether this message is TTS.

  • files – Files of the message.

  • embeds – List of embeds of the message.

  • allowed_mentions – Allowed mentions of the message.

  • components – Components of the message.

  • attachments – List of attachment objects.

  • flags – Flags of the message.

edit_webhook_message(webhook_id, webhook_token, message_id, content=Empty, embeds=Empty, files=Empty, allowed_mentions=Empty, attachments=Empty, components=Empty)

Sends edit webhook message request. :param webhook_id: ID of the webhook. :param webhook_token: Token of the webhook. :param message_id: ID of the message to edit. :param content: Content of the message. :param embeds: List of embed of the message. :param files: Files of the message. :param allowed_mentions: Allowed mentions of the message. :param attachments: Attachments to keep. :param components: Components of the message.

download(url)

Downloads file from passed url.

Parameters:

url – URL to download.

classmethod create(token, *args, **kwargs)

Creates new HTTP request client.

Parameters:
  • token – Token of the bot.

  • args – Extra optional args.

  • kwargs – Extra optional keyword args.

Returns:

Initialized object.