Webhook Models#
संस्करण 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
- प्रदत्त प्रकार :
- 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.
महत्त्वपूर्ण
The
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
allowed_mentions (Optional[Union[AllowedMentions, dict]]) -- The allowed mentions for the message.
components (Union[ActionRow, Button, SelectMenu, List[ActionRow], List[Button], List[SelectMenu]]) -- the components to include with the message
files (Union[File, List[File]]) -- The files to attach to the message
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
- प्रदत्त प्रकार :
Optional[Message]