Classes

Here is a list of all classes.

Author

class dhooks_lite.Author(name: str, url: str = None, icon_url: str = None, proxy_icon_url: str = None)

Author in an Embed

asdict() → dict

returns a dict representation of this object

will not include properties that are None

classmethod from_dict(obj_dict: dict) → dhooks_lite.embed._EmbedObject

creates a new object from the given dict

Embed

class dhooks_lite.Embed(description: str = None, title: str = None, url: str = None, timestamp: datetime.datetime = None, color: int = None, footer: dhooks_lite.embed.Footer = None, image: dhooks_lite.embed.Image = None, thumbnail: dhooks_lite.embed.Thumbnail = None, author: dhooks_lite.embed.Author = None, fields: List[dhooks_lite.embed.Field] = None)

Embedded content for a message

Initialize an Embed object

Parameters:
  • description – message text for this embed
  • title – title of embed
  • url – url of embed
  • timestamp – timestamp of embed content
  • color – color code of the embed
  • footer – footer information
  • image – image within embed
  • thumbnail – thumbnail for this embed
  • author – author information
  • fields – fields information
Exceptions:
TypeException: when passing variables of wrong type ValueException: when embed size exceeds hard limit
asdict() → dict

returns a dict representation of this object

will not include properties that are None

classmethod from_dict(obj_dict: dict) → dhooks_lite.embed._EmbedObject

creates a new object from the given dict

Field

class dhooks_lite.Field(name: str, value: str, inline: bool = True)

Field in an Embed

asdict() → dict

returns a dict representation of this object

will not include properties that are None

classmethod from_dict(obj_dict: dict) → dhooks_lite.embed._EmbedObject

creates a new object from the given dict

Image

class dhooks_lite.Image(url: str, proxy_url: str = None, height: int = None, width: int = None)

Image in an Embed

asdict() → dict

returns a dict representation of this object

will not include properties that are None

classmethod from_dict(obj_dict: dict) → dhooks_lite.embed._EmbedObject

creates a new object from the given dict

Thumbnail

class dhooks_lite.Thumbnail(url: str, proxy_url: str = None, height: int = None, width: int = None)

Thumbnail in an Embed

asdict() → dict

returns a dict representation of this object

will not include properties that are None

classmethod from_dict(obj_dict: dict) → dhooks_lite.embed._EmbedObject

creates a new object from the given dict

UserAgent

class dhooks_lite.UserAgent(name: str, url: str, version: str)

Defines the content of the user agent string send to Discord

Parameters:
  • name – Name of the application
  • url – Homepage URL of the application
  • version – Version of the application

Webhook

class dhooks_lite.Webhook(url: str, username: str = None, avatar_url: str = None, user_agent: dhooks_lite.client.UserAgent = None)

A Discord Webhook

Initialize a Webhook object

Parameters:
  • url – Discord webhook url
  • username – Override default user name of the webhook
  • avatar_url – Override default avatar icon of the webhook with image URL
  • user_agent – User agent to be send with every request to Discord.
execute(content: str = None, embeds: List[dhooks_lite.embed.Embed] = None, tts: bool = None, username: str = None, avatar_url: str = None, wait_for_response: bool = False, max_retries: int = 3) → dhooks_lite.client.WebhookResponse

Posts a message to this webhook

Parameters:
  • content – Text of this message
  • embeds – List of Embed objects to be attached to this message
  • tts – Whether or not the message will use text-to-speech
  • username – Overrides default user name of the webhook
  • avatar_url – Override default avatar icon of the webhook with image URL
  • wait_for_response – Whether or not to wait for a send report from Discord
  • max_retries – maximum number of retries on errors. 0 turns it off.
Exceptions:
ValueError: on invalid input ConnectionError: on network issues Timeout: if timeouts are exceeded TooManyRedirects: if configured redirect limit is exceeded
Returns:response from webhook as WebhookResponse object

WebhookResponse

class dhooks_lite.WebhookResponse(headers: dict, status_code: int, content: dict = None)

response from a Discord Webhook

content

content of the response, e.g. send report

will be empty if not waited for response from Discord

headers

response headers

status_code

HTTP status code of the response

status_ok

whether the response was ok based on its HTTP status