New in version 4.3.0.
- class interactions.api.models.webhook.Webhook(kwargs_dict=None, /, **other_kwargs)#
A class object representing a Webhook.
id (Snowflake) – the id of the webhook
type (WebhookType) – the type of the webhook
guild_id (Snowflake) – the guild id this webhook is for, if any
channel_id (Snowflake) – the channel id this webhook is for, if any
user (User) – the user this webhook was created by (not returned when getting a webhook with its token)
name (str) – the default name of the webhook
avatar (str) – the default user avatar hash of the webhook
token (str) – the secure token of the webhook (returned for Incoming Webhooks)
application_id (Snowflake) – the bot/OAuth2 application that created this webhook
source_guild (Guild) – the guild of the channel that this webhook is following (returned for Channel Follower Webhooks)
source_channel (Channel) – the channel that this webhook is following (returned for Channel Follower Webhooks)
url (str) – the url used for executing the webhook (returned by the webhooks OAuth2 flow)
- async classmethod create(client, channel_id, name, avatar=<interactions.MISSING>)#
Creates a webhook in a channel.
The created webhook as object
- Return type:
- async classmethod get(client, webhook_id, webhook_token=<interactions.MISSING>)#
Gets an existing webhook.
- async modify(name=<interactions.MISSING>, channel_id=<interactions.MISSING>, avatar=<interactions.MISSING>)#
Modifies the current webhook.
- async execute(content=<interactions.MISSING>, username=<interactions.MISSING>, avatar_url=<interactions.MISSING>, tts=<interactions.MISSING>, embeds=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>, attachments=<interactions.MISSING>, components=<interactions.MISSING>, files=<interactions.MISSING>, thread_id=<interactions.MISSING>)#
Executes the webhook. All parameters to this function are optional.
componentsargument requires an application-owned webhook.
content (str) – the message contents (up to 2000 characters)
username (str) – override the default username of the webhook
avatar_url (str) – override the default avatar of the webhook
tts (bool) – true if this is a TTS message
attachments (Optional[List[Attachment]]) – The attachments to attach to the message. Needs to be uploaded to the CDN first
thread_id (int) – Send a message to a specified thread within a webhook’s channel. The thread will automatically be unarchived
The sent message, if present
- Return type:
- async delete()#
Deletes the webhook.