Overview
ThecreateBot() function is the main entry point for initializing your Flora bot. It registers prefix commands, slash commands, and sets up event handlers.
Signature
Parameters
Configuration object for the bot
Return Value
Returnsvoid. The function sets up global event handlers and registers commands.
Behavior
- Idempotent: Can be called multiple times but only initializes once
- Auto-registration: Slash commands are automatically registered with Discord
- Event handling: Sets up
messageCreateandinteractionCreatehandlers - Prefix parsing: Automatically parses prefix commands from messages
Example
Notes
- Must be called before the bot starts processing events
- Prefix and slash commands can be used together
- The
commandsandprefixCommandsparameters are equivalent - Slash commands are automatically registered to the guild on bot startup