Releases: hyvnova/discord-bot-devkit
Releases · hyvnova/discord-bot-devkit
Version 1.2
New
Interaction Control
; Controls who can use an interaction. (interaction_control
module)
Changes
- Removed
EmbedTemplate
; Needs a re-work
Bug Fix
Embed
could not recieveauthor
as init parameter
Full Changelog: https://github.com/EZSNoVa/DicortBotDevKit/commits/v1.2
Version 1.1.0
Major changes
- Fixed
Embed
and added support for more properties (footer
,author
) Fixed
Modaland added
as_dict` method
Minor Changes
states
module is almost working. Need to fixprocess_states
methods and correcto ther mior bugs- Fixed type hints
- Resolved imports overlapping
Other changes
Modal
now doesnt requireRoot
and is not part ofRootItems
- Added
EmbedFooter
andEmbedAuthor
classes
Added
states` module (concent module)
Full Changelog: v1.0.0...v1.1.0
Version 1.0.0 (Stable)
First stable verion of DBDK
Full Changelog: https://github.com/EZSNoVa/DicortBotDevKit/commits/v1.0.0
NoVa - Discord Bot Dev Kit
Is a set of funtions and classes to simplify the creation of discord bots
Installing DBDK
pip install dbdk
- You can install DBDK manually using PyPI
Importing DBDK
from dbdk import *
Note: check Imports and defined members to know what's being imported
Creating A Root
@bot.command(name="sample")
async def sample_command(ctx: commands.context.Context):
root: Root = await createRoot(ctx)
- Roots are the start and managers of everything in DBDK.
In most cases you will only need 1 root per command.
View
Introduction
- As shown in the example above, we assuming this is inside a command function definition.
root: Root = createRoot(ctx)
# by default `root` has a `view` property
root.view
# You can add items to the view using `add_item` or `add_items` methods
await root.view.add_items(
Button(on_click_callback, "This is the label"),
SelectMenu(
on_select_callback, options = [
SelectOption
]
)
)
-
add_item and add_items methods update the root, so changes will be displayed when they're called
-
Check Pycord API reference: discord.ui.View for more details.
Adding a Button
to the view
# Create a on click callback function; this function is called when the button is clicked
async def on_click(clicked_button: Button, interaction: discord.Interaction):
# respond the interacion
await interaction.response.send_message("You Clicked the button!")
await root.view.add_items(
Button(
on_click,
label = "Click Me!",
emoji = '🙂'
)
)
# That's all, you'll see changes reflected in the root message
- Check Pycord API reference: discord.Button for more details.
Embeds
await root.embeds.add_items(
Embed(
title = "My Embed",
description = "My embed description :D",
color = discord.Color.green()
)
)
- Check Pycord API reference: discord.Embed for more details.