ClientCompoundWebhookEndpoints
Methods
()
__new__Compound components do not support instancing.
Sub-typing is supported, but the attributes are only proxied. Sub-types have no meaning by themselves.
Raises
RuntimeError
(channel, name, ...)
webhook_createCreates a webhook at the given channel.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
channel |
| The channel of the created webhook. | |||
name |
| The name of the new webhook. It's length can be in range [1:80]. | |||
avatar |
|
| The webhook's avatar. Can be |
Returns
webhook : Webhook
The created webhook.
Raises
TypeError
- If
channel
was not given neither asChannel
nor asint
. - If
avatar
was not given neither asNone
,bytes-like
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was not given asstr
. - If
name
range is out of the expected range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
(webhook)
webhook_deleteDeletes the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to delete. |
Raises
TypeError
If webhook
was not given neither as Webhook
, int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.webhook_delete_token
: Deleting webhook with Discord's webhook API.
(webhook, webhook)
webhook_delete_tokenDeletes the webhook through Discord's webhook API.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to delete. |
webhook | The webhook to delete. |
Raises
TypeError
If webhook
was not given neither as Webhook
neither as a tuple
(int
, str
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
(webhook, ...)
webhook_editEdits and updates the given webhook.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook to edit. | ||
name |
| The webhook's new name. It's length can be in range [1:80]. | ||
avatar |
| The webhook's new avatar. Can be | ||
channel |
| The webhook's channel. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was given but not asstr
. - If
name
's length is out of range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
See Also
.webhook_edit_token
: Editing webhook with Discord's webhook API.
(webhook, ...)
webhook_edit_tokenEdits and updates the given webhook through Discord's webhook API.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook to edit. | ||
name |
| The webhook's new name. It's length can be between | ||
avatar |
| The webhook's new avatar. Can be |
Returns
webhook : Webhook
The updated webhook.
Raises
TypeError
- If
webhook
was not given neither asWebhook
neither as atuple
(int
,str
). - If
avatar
was not given neither asNone
nor asbytes-like
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
- If
name
was given but not asstr
. - If
name
's length is out of range [1:80]. - If
avatar
's type is not any of the expected ones:'jpg'
,'png'
,'webp'
,'gif'
.
Notes
This endpoint cannot edit the webhook's channel, like .webhook_edit
.
(webhook)
webhook_getRequests the webhook by it's id.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to update or the webhook's id to get. |
Returns
webhook : Webhook
Raises
TypeError
If webhook
was not given neither as Webhook
neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the webhook already loaded and if it's guild's webhooks are up to date, no request is done.
See Also
.webhook_get_token
: Getting webhook with Discord's webhook API.
(channel)
webhook_get_all_channelRequests all the webhooks of the channel.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
channel |
| The channel, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
Raises
TypeError
If channel
was not given neither as Channel
, neither as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
You may expect the following exceptions:
Error code | Internal name | Reason |
---|---|---|
10003 | unknown_channel | The channel not exists. |
50013 | missing_permissions | You need manage_webhooks permission. (Or the client has no access to the channel.) |
60003 | mfa_required | You need to have multi-factor authorization to do this operation (guild setting dependent). For bot accounts it means their owner needs mfa. |
Discord drops
Forbidden (403), code = 50013: Missing Permissions
instead ofForbidden (403), code = 50001: Missing Access
.
AssertionError
If channel
was given as a channel's identifier but it detectably not refers to a Channel
.
Notes
No request is done, if the passed channel is partial, or if the channel's guild's webhooks are up to date.
(guild)
webhook_get_all_guildRequests the webhooks of the given guild.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
guild |
| The guild, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
Raises
TypeError
If guild
was not given neither as Guild
nor as int
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
No request is done, if the guild's webhooks are up to date.
(channel)
webhook_get_own_channelRequests the webhooks of the given channel and returns the first owned one.
Parameter | Type | Description |
---|---|---|
channel |
| The channel, what's webhooks will be requested. |
Returns
webhooks : list
of Webhook objects
(webhook)
webhook_get_tokenRequests the webhook through Discord's webhook API. The client do not needs to be in the guild of the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook to update or the webhook's id and token. |
Returns
webhook : Webhook
Raises
TypeError
If webhook
was not given neither as Webhook
neither as a tuple
(int
, str
).
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
If the webhook already loaded and if it's guild's webhooks are up to date, no request is done.
(webhook, ...)
webhook_message_createSends a message with the given webhook. If there is nothing to send, or if wait
was not passed as True
returns None
.
This method is a coroutine.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
webhook |
| The webhook through what will the message be sent. | |||
*positional_parameters | Positional parameters | Additional parameters to create the message with. | |||
thread |
|
| The thread of the webhook's channel where the message should be sent. | ||
wait |
|
| Whether we should wait for the message to send and receive it's data as well. | ||
**keyword_parameters | Keyword parameters | Additional parameters to create the message with. | |||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | |||
applied_tag_ids |
| The tags' identifier which have been applied to the thread. Applicable for threads of a forum-like channels. | |||
applied_tags |
| Alternative for | |||
attachments |
| Attachments to send. | |||
avatar_url |
|
| The message's author's avatar's url. Defaults to the webhook's avatar' url by Discord. | ||
components |
| Components attached to the message. | |||
content |
| The message's content if given. | |||
embed |
| Alternative for | |||
embeds |
| The new embedded content of the message. | |||
file |
| Alternative for | |||
files |
| Alternative for | |||
flags |
| The message's flags. | |||
name |
|
| The message's author's new name. Default to the webhook's name by Discord. | ||
silent |
|
| Whether the message should be delivered silently. | ||
suppress_embeds |
|
| Whether the message's embeds should be suppressed initially. | ||
thread_name |
| The thread's name to create. Applicable only in forum-like channels. | |||
tts |
|
| Whether the message is text-to-speech. |
Returns
message : Message
, None
Returns None
if there is nothing to send or if wait
was given as False
(so by default).
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.message_create
: Create a message with your client..webhook_message_edit
: Edit a message created by a webhook..webhook_message_delete
: Delete a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message)
webhook_message_deleteDeletes the message sent by the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook who created the message. |
message |
| The webhook's message to delete. |
Raises
TypeError
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
AssertionError
If message
was detectably not sent by the webhook
.
See Also
.message_delete
: Delete a message..webhook_message_create
: Create a message with a webhook..webhook_message_edit
: Edit a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message, ...)
webhook_message_editEdits the message sent by the given webhook. The message's author must be the webhook itself.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
webhook |
| The webhook who created the message. | ||
message |
| The webhook's message to edit. | ||
*positional_parameters | Positional parameters | Additional parameters to edit the message with. | ||
**keyword_parameters | Keyword parameters | Additional parameters to edit the message with. | ||
allowed_mentions |
| Which user or role can the message ping (or everyone). Check | ||
attachments |
| Attachments to send. | ||
components |
| Components attached to the message. Pass it as | ||
content |
| The new content of the message. | ||
embed |
| Alternative for | ||
embeds |
| The new embedded content of the message. By passing it as | ||
file |
| Alternative for | ||
files |
| Alternative for | ||
flags |
| The message's new flags. | ||
suppress_embeds |
| Whether the message's embeds should be suppressed or unsuppressed. |
Raises
TypeError
- If a parameter's type is incorrect.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
Notes
Embed messages ignore suppression with their endpoint, not like .message_edit
endpoint.
Editing the message with empty string is broken.
See Also
.message_edit
: Edit your own messages..webhook_message_create
: Create a message with a webhook..webhook_message_delete
: Delete a message created by a webhook..webhook_message_get
: Get a message created by a webhook.
(webhook, message_id)
webhook_message_getGets a previously sent message with the webhook.
This method is a coroutine.
Parameter | Type | Description |
---|---|---|
webhook |
| The webhook who created the message. |
message_id |
| The webhook's message's identifier to get. |
Returns
message : Message
Raises
TypeError
- If
webhook
was not given neither asWebhook
neither as atuple
(int
,str
). - If
message_id
was not given asint
.
ConnectionError
No internet connection.
DiscordException
If any exception was received from the Discord API.
See Also
.message_get
: Get a message..webhook_message_create
: Create a message with a webhook..webhook_message_edit
: Edit a message created by a webhook..webhook_message_delete
: Delete a message created by a webhook.