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 *
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 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.
Imports And Defined Members
- This may vary a lot.
-
Any =
typing.Any
-
Await =
typing.Await
-
Awaitable =
typing.Awaitable
-
Bot =
discord.ext.commands.Bot
-
Button =
discord.ui.Button
-
ButtonStyle =
discord.ButtonSyle
-
Callable =
typing.Calleable
-
Colour =
discord.Colour
-
Component =
discord.Component
-
Dict =
typing.Dict
-
Embed =
discord.Embed
-
EmbedField =
discord.EmbedField
-
EmbedList =
dbdk.embed.EmbedList
-
EmbedTemplate =
dbdk.embed.EmbedTemplate
-
Emoji =
discord.Emoji
-
ExceptionList =
dbdk.utils.ExceptionList
-
InputText =
discord.ui.InputText
-
InputTextStyle =
discord.InputTextStyle
(Shortcut) -
InputTextType =
discord.InputTextStyle
(Shortcut) -
List =
typing.List
-
Modal =
dbdk.modal.Modal
-
OptionType = ?
-
Root =
dbdk.root.Root
-
RootItems =
dbdk.root.RootItems
-
SelectMenu =
dbdk.components.SelectMenu
-
SelectOption =
dbdk.components.SelectOption
-
States =
dbdk.utils.States
(Concept class) -
Tuple =
typing.Tuple
-
Union =
typing.Union
-
View =
dbdk.view.View
-
commands =
discord.ext.commands
-
components =
dbdk.components
(Module) -
create_root =
dbdk.kit.create_root
-
datetime =
datetime
(Module) -
default_on_select =
dbdk.components.default_on_select
-
default_on_submit =
dbdk.modal.default_on_submit
-
default_on_timeout =
dbdk.view.default_on_timeout
-
discord =
discord
(Module) -
embed =
dbdk.embed
(Module) -
extract =
dbdk.utils.extract
-
modal =
dbdk.modal
(Module) -
namedtuple =
collections.namedtuple
-
root =
dbdk.root
(Module) -
types =
dbdk.types
(Module) -
ui =
discord.ui
(Shortcut) -
utils =
dbdk.utils
(Module) -
view =
dbdk.view
(Module)
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.0.1.tar.gz
(10.3 kB
view hashes)
Built Distribution
dbdk-1.0.1-py3-none-any.whl
(10.9 kB
view hashes)