Commands
Commands in DDBKit come with a bunch of modifiers to control its behaviour. DDBKit includes Discord API modifiers (modifiers that directly control the command during registration, or modifiers that provide callbacks for discord command events). You can find more utilities in the DDBKitUtilities module which provides tools like Message builders and some misc abstractions.
To start, take a look at this command:
This demonstrates a few things to note. We use the respond(:)
method on our InteractionExtras
to send a Message
object.
The Message
object allows you to take a result builder approach to structuring your message payload. You fill the message
with MessageComponent
types like MessageEmbed
as seen here, or MessageContent
for the text content of the message.
Send attachments with MessageAttachment
and attach message components with MessageComponents
.
InteractionExtras
is a special wrapper type around DiscordBM’s Interaction
type. It provides a few extra utilities
for handling interactions, such as the respond(:)
method and more.
The above example sets up text content in the message, but if you only need to send text, you can skip MessageContent
like below:
This demonstrates the process of structuring an embed, and using attachments in embeds or elsewhere. If you wish to have the attachment actually attach to the message rather than be uploaded for use elsewhere, omit the usage modifier.
This example demonstrates using components!
The component events can be received through the aptly named component modifiers. You can either specify a hardcoded component ID to respond to, or omit the on
parameter entirely to receive all events.