0.7.4 • Published 12 months ago

@wizardtower/beacon v0.7.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Beacon

Beacon is a discord bot framework which aims to expose discord as a player interaction engine.

Dependencies

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.

OptionDefault ValueDescription
tokenrequired'Discord Bot token, used in bot creation.
botNamerequiredThe 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
activityOptionsnonewhat 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?
disableLogFilefalseturn off logging beacon activity to file
fastBootfalsewhether or not to use a faster boot animation. Off by default because it's more satisfying that way.
noCliClearfalseWhether 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.
initCustomLogoBeacon LogoBy default, the Beacon logo will show after initialization. This option allows you to supply your own ASCII logo
commandFolderPathwhere your command .js files are located. Not your .ts files, your .js files. This allows for reloading commands on the fly!
templateFolderPathwhere your template.js files are located. This allows for validation and reloading templates on the fly!
logFolderPathrootwhere to put the log file(s)
keepUnhandledGlobalCommandsFALSEleave global commands visible to bot users even if they no longer exist
loadDefaultCommandsTRUEwether or not to load default commands which are bundled with Beacon
loadDefaultTemplatesTRUEwhether or not to load default templates which are bundled with Beacon
adminDiscordUserIdsnoneDiscordIds 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

DescriptionPathStatusType
exports/index.tsCompleteExports
main beacon functionality/src/beacon.tsCompleteCore - Beacon
slash command registry, validation, defaults/src/userInterface/commands/CompleteUser Input
Scenes/src/userInterface/Scene.tsCompleteUser Input
Scene Loading (reconnecting to scenes on bot restart)/src/userInterface/SceneLoader.tsCompleteUser Input
Scene templates, validation, loading, defaults/src/userInterface/Button.tsCompleteUser Input
Event handling/src/userInterface/events/CompleteRendering
Default commands, embeds, etc./src/userInterface/defaults/CompleteDefault UIUX
Event Parsers/src/userInterface/events/CompleteEvents
Utilities/src/util/CompleteUtilities
0.7.4

12 months ago

0.7.3

12 months ago

0.7.2

12 months ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.3

2 years ago