Projects & Examples

Practical, real-world examples for using BotBox in your Discord bot projects.


Add a Slash Command with Arguments

sh
botbox add
  • Choose a cog name (e.g., fun)
  • Select slash as the command type
  • Name the command (e.g., roll)
  • Add arguments (e.g., sides: int)
  • Set a description and return type

Result:
A /roll command that takes a number of sides and returns a random roll.


Generate the Same Cog Without the TUI

Keep the command definition in a file and generate the cog from it.

[
  {
    "Name": "roll",
    "Scope": "guild",
    "Type": "slash",
    "Description": "Rolls a die",
    "Args": [
      { "Name": "sides", "Type": "int", "Description": "Number of sides" }
    ],
    "ReturnType": "None"
  }
]

Collect Feedback With a Modal

sh
botbox add Feedback --commands '[
  {
    "Name": "feedback",
    "Scope": "guild",
    "Type": "modal",
    "Description": "Collects user feedback",
    "Fields": [
      { "Name": "subject", "Label": "Subject", "Style": "short", "Required": true, "Placeholder": "Short summary" },
      { "Name": "details", "Label": "Details", "Style": "paragraph", "Required": false, "Placeholder": "" }
    ],
    "ReturnType": "None"
  }
]'

Result:
A /feedback command that opens a popup form with a one-line subject and a multi-line details box. Edit on_submit in the generated cog to decide where the submission goes. See Modal Commands.


Use Doppler for Multiple Environments

  • Set up Doppler projects for development and production
  • Store different tokens/secrets in each
  • Use the doppler run -- command or the generated run.sh to run your bot in the correct environment

Reload Cogs at Runtime

  • Use the /reload-cog slash command (provided by cogs.py)

  • Or, run:

    sh
    botbox config sync

    to update your config after adding/removing cogs manually.


More Examples Coming Soon!

Have a project to share? Open a pull request!