@wizardtower/beacon v0.7.4
Beacon
Beacon is a discord bot framework which aims to expose discord as a player interaction engine.
Dependencies
- discordjs, for interface with discord api
- ascii-table, for generating stats
- cli-swag, for command line goodness
Getting started
install from npm
npm install @wizardtower/beacon
copy .env.example
and remove .example. Replace Sample passwords and tokens with valid ones. Check out parseEnv.ts in Candle for a reference implementation of this
As of version 0.7.3, your version of discordjs MUST MATCH the version used by beacon. Run with discordjs version 14.8.0
and node version 16 or higher
npm run dev
Configuration
Most configuration is done via the beaconConfig option, passed to the client at initialization.
Option | Default Value | Description |
---|---|---|
token | required | 'Discord Bot token, used in bot creation. |
botName | required | The name of this project, used in CLI, logs, and optionally to set the name of your bot |
environment | 'DEVELOPMENT' | 'DEVELOPMENT', 'STAGING', 'PRODUCTION', or 'TESTING' - specifies the development environment |
activityOptions | none | what to show your bot as doing in discord - e.g., playing a game. More Information |
logColor | 'GREEN' | what color to make your CLI - incredibly fancy? If set to false, removes color (helps with readability in environments which do not support color escape codes) |
logMode | 'DEFAULT' | should beacon logs be verbose, off, or a happy medium? |
disableLogFile | false | turn off logging beacon activity to file |
fastBoot | false | whether or not to use a faster boot animation. Off by default because it's more satisfying that way. |
noCliClear | false | Whether or not to clear the command line during boot animation, this can be desabled to improve compatability in environments which do not support CLI clearing. |
initCustomLogo | Beacon Logo | By default, the Beacon logo will show after initialization. This option allows you to supply your own ASCII logo |
commandFolderPath | where your command .js files are located. Not your .ts files, your .js files. This allows for reloading commands on the fly! | |
templateFolderPath | where your template.js files are located. This allows for validation and reloading templates on the fly! | |
logFolderPath | root | where to put the log file(s) |
keepUnhandledGlobalCommands | FALSE | leave global commands visible to bot users even if they no longer exist |
loadDefaultCommands | TRUE | wether or not to load default commands which are bundled with Beacon |
loadDefaultTemplates | TRUE | whether or not to load default templates which are bundled with Beacon |
adminDiscordUserIds | none | DiscordIds of users who are able to run bot-config level commands (any command with adminOnly:true) such as disabling a command. |
Scenes
Commands
Beacon supports Discord Slash Commands! Commands can be added by supplying a folder full of .js command files. These files each must have a default export of a 'command' interface.
Commands are ran through command validators in an attempt to reduce runtime errors.
Default commands are located in /src/userInterface/commands/defaults/
and can be toggled on or off via the option in the beaconConfig.
Development
Beacon is intended to be used along-side Discord.js to provide specific utilities (cli, logging, statistics) and the Scene UI functionality to make more intuitive user-facing apps with ease
File Hierarchy
Description | Path | Status | Type |
---|---|---|---|
exports | /index.ts | Complete | Exports |
main beacon functionality | /src/beacon.ts | Complete | Core - Beacon |
slash command registry, validation, defaults | /src/userInterface/commands/ | Complete | User Input |
Scenes | /src/userInterface/Scene.ts | Complete | User Input |
Scene Loading (reconnecting to scenes on bot restart) | /src/userInterface/SceneLoader.ts | Complete | User Input |
Scene templates, validation, loading, defaults | /src/userInterface/Button.ts | Complete | User Input |
Event handling | /src/userInterface/events/ | Complete | Rendering |
Default commands, embeds, etc. | /src/userInterface/defaults / | Complete | Default UIUX |
Event Parsers | /src/userInterface/events / | Complete | Events |
Utilities | /src/util/ | Complete | Utilities |