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

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 = 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

Field

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

Field in an Embed

Image

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

Image in an Embed

Thumbnail

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

Thumbnail in an Embed

Webhook

class dhooks_lite.Webhook(url: str, username: str = None, avatar_url: str = 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
execute(content: str = None, embeds: list = None, tts: bool = None, username: str = None, avatar_url: str = None, wait_for_response: bool = False) → 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 (defaults to False).

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