Discord Bot Dev Kit is a set of funtions and classes to simplify the creation of discord bots
Project description
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 *
Creating A Root
@bot.command(name="sample")
async def sample_command(ctx: commands.context.Context):
root: Root = await create_root(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 = await create_root(ctx)
# by default `root` has a `view` property
root.view
# You can add items to the view using `add_items` method
await root.view.add_items(
Button(on_click_callback, "This is the label"),
SelectMenu(
on_select_callback, options = [
SelectOption
]
)
)
-
add_items method update the root, so changes will be displayed when 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dbdk-1.2.tar.gz
(11.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dbdk-1.2-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file dbdk-1.2.tar.gz.
File metadata
- Download URL: dbdk-1.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56f019eae24dee006a142b2401595e14c042bab3fd8bea61b544355c1735b22e
|
|
| MD5 |
df32a48b9b89ac74bb2ac88ef5b2a4aa
|
|
| BLAKE2b-256 |
3e99787681cb626da1481336bdab7373c8ae3fe3e868fa772e3ce3a8b2602907
|
File details
Details for the file dbdk-1.2-py3-none-any.whl.
File metadata
- Download URL: dbdk-1.2-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
331da4b1b24d1446c7e395921c964d08bce18ace52322aafa3857bccf4240e08
|
|
| MD5 |
7e09be5339f0d96324b6df6b02efbf4e
|
|
| BLAKE2b-256 |
982620ae7a9a552360991195b826ce1af131f0faf8ae2d41b9b062009fe32a68
|