curious.dataclasses.webhook¶
Wrappers for Webhook objects.
Classes
Webhook(client, **kwargs) |
Represents a webhook on the guild. |
-
class
curious.dataclasses.webhook.Webhook(client, **kwargs) → None[source]¶ Bases:
curious.dataclasses.bases.DataclassRepresents a webhook on the guild. Messages in a guild can be sent by either a Member or a Webhook object - curious makes a key distinction between them. These classes are mostly compatible and don’t require much effort to use them generically.
@event("message_create") async def handle_messages(ctx, message: Message): author = message.author # can be Webhook or Member
Inspects the stack to ensure we’re being called correctly.
-
user¶ The user object associated with this webhook.
-
guild_id¶ The ID of the Guild associated with this object.
-
channel_id¶ The ID of the Channel associated with this object.
-
token¶ The token associated with this webhook. This is None if the webhook was received from a Message object.
-
owner¶ The owner of this webhook.
-
default_name¶ The default name of this webhook.
-
_default_avatar¶ The default avatar of this webhook.
-
classmethod await
create(*, name, avatar)[source]¶ Creates a new webhook.
Parameters: Return type: Returns: A new
Webhook.
-
await
get_token()[source]¶ Gets the token for this webhook, if no token was set earlier.
Return type: strReturns: The token for the webhook.
-
await
delete()[source]¶ Deletes the webhook.
You must either be the owner of this webhook, or the webhook must have a token associated to delete it.
Return type: None
-
await
edit(*, name=None, avatar=None)[source]¶ Edits this webhook.
Parameters: Return type: Returns: The webhook object.
-
await
execute(*, content=None, username=None, avatar_url=None, embeds=None, wait=False)[source]¶ Executes the webhook.
Parameters: - content (
Optional[str]) – Any raw content to send. - username (
Optional[str]) – A username to override the default username of the webhook with. - avatar_url (
Optional[str]) – The URL for the avatar to override the default avatar with. - embeds (
Optional[List[Embed]]) – A list of embeds to add to the message. - wait (
bool) – Should we wait for the message to arrive before returning?
Return type: - content (
-