abstract¶
Abstract views to be inherited by other views.
Inheritable views that include extra functionality for base Views classes.
- class byte_bot.byte.views.abstract_views.ButtonEmbedView(author: int, bot: Bot, original_embed: Embed, minified_embed: Embed, *args, **kwargs)[source]¶
Bases:
View
Base view including common buttons.
Initialize the view.
- Parameters:
author – Author ID.
bot – Bot object.
original_embed – The original embed to display.
minified_embed – The minified embed to display.
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- __init__(author: int, bot: Bot, original_embed: Embed, minified_embed: Embed, *args, **kwargs) None [source]¶
Initialize the view.
- Parameters:
author – Author ID.
bot – Bot object.
original_embed – The original embed to display.
minified_embed – The minified embed to display.
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- async delete_interaction_check(interaction: Interaction) bool [source]¶
Check if the user is the author or a guild admin.
Note
Only checks for the
delete
button, as we want to expose thelearn more
button to anyone.- Parameters:
interaction – Interaction object.
- Returns:
True if the user is the author or a guild admin, False otherwise.
- async delete_button_callback(interaction: Interaction) None [source]¶
Delete the message this view is attached to.
- Parameters:
interaction – Interaction object.
- async learn_more_button_callback(interaction: Interaction) None [source]¶
Send the original embed to the user privately.
- Parameters:
interaction – Interaction object.
- class byte_bot.byte.views.abstract_views.ExtendedEmbed(*, colour: int | Colour | None = None, color: int | Colour | None = None, title: Any | None = None, type: EmbedType = 'rich', url: Any | None = None, description: Any | None = None, timestamp: datetime.datetime | None = None)[source]¶
Bases:
Embed
Extended Embed class for discord.py.
- add_field_dict(field: Field) Self [source]¶
Add a field to the embed.
- Parameters:
field (Field) – The field to add to the embed.
- Returns:
The embed with the field added.
- Return type:
Self
- classmethod from_field_dicts(colour: int | Colour | None = None, color: int | Colour | None = None, title: Any | None = None, type: Literal['rich', 'image', 'video', 'gifv', 'article', 'link'] = 'rich', url: Any | None = None, description: Any | None = None, timestamp: datetime | None = None, fields: list[Field] | None = None) Self [source]¶
Create an embed from a list of fields.
- Parameters:
colour (int | Colour | None) – The colour of the embed.
color (int | Colour | None) – The colour of the embed.
title (Any | None) – The title of the embed.
type (Literal["rich", "image", "video", "gifv", "article", "link"]) – The type of the embed.
url (Any | None) – The URL of the embed.
description (Any | None) – The description of the embed.
timestamp (datetime | None) – The timestamp of the embed.
fields (list[Field] | None) – A list of fields to add to the embed.
- Returns:
The embed with the fields added.
- Return type:
Self