Webhook¶
discord_http.webhook module¶
- class discord_http.webhook.PartialWebhook(*, state, id, token=None)¶
Bases:
PartialBase
- Parameters:
state (DiscordAPI)
id (int)
token (str | None)
- async edit(*, name=<MISSING>, avatar=<MISSING>, channel_id=<MISSING>, reason=None) Webhook ¶
Edit the webhook.
- async send(content=<MISSING>, *, username=<MISSING>, avatar_url=<MISSING>, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, ephemeral=False, view=<MISSING>, type=4, allowed_mentions=<MISSING>, wait=True, flags=<MISSING>, thread_id=<MISSING>, poll=<MISSING>) WebhookMessage | None ¶
Send a message with the webhook.
- Parameters:
ephemeral (
bool
|None
) – Whether the message should be sent as ephemeraltype (
ResponseType
|int
) – Which type of response should be sentallowed_mentions (
AllowedMentions
|None
) – Allowed mentions of the messagewait (
bool
) – Whether to wait for the message to be sentflags (
MessageFlags
|None
) – Flags of the message
- Return type:
- Returns:
The message that was sent, if wait is True.
- Raises:
If the webhook has no token - If avatar_url does not start with https://
- class discord_http.webhook.Webhook(*, state, data)¶
Bases:
PartialWebhook
- Parameters:
state (DiscordAPI)
data (dict)
- property channel: PartialChannel | None¶
Returns the channel the webhook is in.
- classmethod from_state(*, state, data) Webhook ¶
Creates a webhook from data, usually used for followup responses.
- Parameters:
state (
DiscordAPI
) – The state to use for the webhookdata (
dict
) – The data to use for the webhook
- Return type:
- Returns:
The webhook that was created
- property guild: Guild | PartialGuild | None¶
Returns the guild the webhook is in.