Saltar a contenido

botcity.plugins.discord.plugin.BotDiscordPlugin

webhook: DiscordWebhook property readonly

Returns the discord-webhook instance.

Returns:

Type Description
discord-webhook

The discord-webhook instance.

__init__(self, urls, username=None, **kwargs) special

BotDiscordPlugin.

Parameters:

Name Type Description Default
urls list or str

Webhook urls.

required
username str

The bot username

None

delete_message(self, message_response, **kwargs)

Delete the message based on the response passed as argument.

Parameters:

Name Type Description Default
message_response requests.Response or list

webhook.execute() response

required

Returns:

Type Description
response

Webhook response.

delete_message_edited(self, message_response_edited)

Delete the message edited based on the response passed as argument.

Parameters:

Name Type Description Default
message_response_edited requests.Response or list

webhook.execute() response

required

Returns:

Type Description
response

Response of message deleted.

edit_message(self, message_response, new_content_message, **kwargs)

Edits the message based on the response passed as argument.

Parameters:

Name Type Description Default
message_response requests.Response or list

webhook.execute() response

required
new_content_message str

The new message content.

required

Returns:

Type Description
response

Webhook response.

send_embedded_message(self, message, **kwargs)

Discord Embed Message.

Parameters:

Name Type Description Default
message EmbeddedMessage

The message content. See EmbeddedMessage

required

Returns:

Type Description
response

Webhook response.

send_file(self, files, **kwargs)

Upload file to the webhook.

Parameters:

Name Type Description Default
files list

The file paths.

required

Returns:

Type Description
response

Webhook response.

send_message(self, content, rate_limit_retry=False, allowed_mentions=None, files=None, **kwargs)

Send a simple message.

Parameters:

Name Type Description Default
content str

The message content.

required
rate_limit_retry bool

if rate_limit_retry is True then in the event that you are being rate limited by Discord your webhook will automatically be sent once the rate limit has been lifted

False
allowed_mentions list

The list of users to ping.

None
files str

Add files.

None

Returns:

Type Description
response

Webhook response.

botcity.plugins.discord.models.Color (Enum)

The color type.

Attributes:

Name Type Description
RED str

The red color in hexadecimal.

GRAY str

The gray color in hexadecimal.

BLUE str

The blue color in hexadecimal.

GREEN str

The green color in hexadecimal.

WHITE str

The white color in hexadecimal.

BLACK str

The black color in hexadecimal.

BROWN str

The brown color in hexadecimal.

YELLOW str

The yellow color in hexadecimal.

PURPLE str

The purple color in hexadecimal.

ORANGE str

The orange color in hexadecimal.

botcity.plugins.discord.models.Author dataclass

Author info.

Attributes:

Name Type Description
url str

Profile url.

name str

Author name.

icon_url str

URL to author profile picture.

botcity.plugins.discord.models.Footer dataclass

Footer info.

Attributes:

Name Type Description
text str

Footer text.

icon_url str

URL to footer icon.

botcity.plugins.discord.models.Field dataclass

Field info.

Attributes:

Name Type Description
name str

Name of field.

value str

Value of field.

inline bool

True if the embed fields are placed side by side, False the field are placed in new line.

botcity.plugins.discord.models.EmbeddedMessage dataclass

The embedded message.

Attributes:

Name Type Description
title str

Title of embed.

description str

Description body of embed.

color Union[str, botcity.plugins.discord.models.Color]

Color code of the embed as hexadecimal string or Color enum.

image str

Your image url here.

author Author

Author information.

footer Footer

Footer texts.

thumbnail str

Your thumbnail url here.

fields List[botcity.plugins.discord.models.Field]

List of Field information.

timestamp float

Timestamp of embed content.

files Union[List[str], Dict[str, bytes]]

Send files in embedded message.