/dnd-helper-bot

A discord D&D 5e helper bot

Primary LanguageJavaScript

D&D 5e Discord Helper

Pre-release - tested running locally on Mac only so far

A Discord bot that aims to augment or improve your online D&D 5e sessions. Currently, the helper bot has two commands to help in that respect:

  • !play {themeName} - the bot will play a track at random into the voice channel you are currently in. This is parsed from a playlist JSON file.
  • !spell {spellSlug} - a spell summary message posted into the channel you are in, provided by the Open5e API.

The intention is to add more feature sets and improve user experience over time. This is very much early days so bugs may be present. Please create an issue if you find one.

Set up

Clone the repo and run npm install. You also need to add an .env file to the root of the project directory and populate it with your Discord bot access token, like so:

ACCESS_TOKEN=yourAccessTokenHere

You should then be able to run the bot locally by running npm run start.

Loading your playlist

The playlist is a JSON file that contains the YouTube videos you want audio to be loaded from and played in the voice channel you are in. The bot uses keys as the command identifier; each key contains an array value of strings that the bot then parses at random to select a track.

Example:

{
    "town": ["url-for-town-example-1", "url-for-town-example-2"],
    "battle": ["battle-example-url"]
}

By default, when you run npm run script, the app will take the playlist.json file from dist/public/playlist.json. You can override this by passing your own playlist in the command line, like so:

npm run build -- --playlist=path/to/your/playlist.json

You can then tell the bot to play music with !play followed by the key. The bot will then choose one of the tracks within that key at random. Of course, if there is only one track, then the bot will play just that (if you wanted to have more control over what track is played).

!play town

Spell Dictionary

The bot can also provide spell details, provided via Open5e.

To fetch details of a spell, you should provide the slugified format of the spell name to the bot, like so:

!spell magic-missile
!spell fireball
!spell arcanists-magic-aura

Example of spell command used via the bot