Giter VIP home page Giter VIP logo

tavernbot's Introduction

TavernBot - The Ultimate RPG Discord Bot for D&D, Pathfinder, and beyond!

The idea: Wouldn't it be great to have a really good D&D bot for discord? I think so. And this is the start of that solution.

TavernBot is a generator bot for Game Masters of D&D. This project is a Discord bot wrapper for the Dungeonary, and several other useful discord functions such as roles and eventually music/ambience in a voice channel.

This is currently an 0.x release - I will document features and such here as they're finished up and as we close in on 1.0, but for now, I'm pouring molten free time into this project to try and forge something awesome. Check the code for now if you want to know more.

Development

Fork this project, then follow these steps to get up and running! Make sure you have node 8+, with an appropriate npm, and a Discord bot token. Go to this link to set up a bot account, add the token to config.json in the project root, then invite the bot to a server for testing. And don't forget npm install.

'npm run devbot' will set you up with a hot-reloading bot instance, and 'npm test' should run quietly with no issues if everything's set up correctly. 'npm run verbosetest' will show you the npm test output, which should look like Discord-formatted responses.

Expectations and how it loads

The bot is set up to load a list of local libs, grab every exported function, and drop the functions + a bit of metadata into a global commander object. That said, this means it calls all functions exactly the same way - and if you need more parameters for some reason, perhaps we should chat. For your new commands to drop in and immediately work, they must have the following signature: f(input:String, message:discord.js#message, client:discord.js#client) - input will be everything after your commands name in the message to the bot (like '!commandname input is all this stuff'), the message will be the full message object per the Discord.js api, and the client is from Discord.js too.

Writing new commands

If you just want to just add a relevant command to a library, you only need step 4. But if you have commands to add that don't seem to fit with the theme of functions in a particular file, follow all of these steps to add a new library folder to the bot:

  1. Make a new directory
  2. Add your new directory to the MODULES array in bot.js
  3. Copy index.js from discordlib or gravemind into your new lib as a handy piece of boilerplate
  4. Write exported functions in your library (Note: The bot ignores the default export!)
  5. Update the index.js in your library so it loads a file you create in your new lib
  6. Run it! You've now added functionality to the bot!

Development triage:

ImportError: no module compiler.ast:

If you see the above issue during 'npm install', just run 'sudo apt install python-dev'. I'm as upset as you are that we need python for npm, but, c'est la vie.

Vague "app crashed" error

An issue with the bot, while testing new commands, is that you have to be very aware of what might throw an error. I don't have error handling set up correctly yet, even though I'm following the recommended client.on('error', callback) approach, so I apologize if this bites you. If you know a way to make node/discord.js run in a hella verbose way, I'd gladly add that to the npm run devbot script


Below is a sort of notepad, and generally contains nothing useful. If you have ideas or features that you think this bot should support, let me know on Github and we'll get it prioritized :D

Source for dungeon world content: https://www.npmjs.com/package/dungeonworld-data

Voice API https://discord.js.org/#/docs/main/stable/topics/voice

Character stats implementation needs PHB spread w/stat priority per class

Keep last 128 roll macros? 256?

Find a good base of Character Sheet JSON

Possibly useful for inspiration https://github.com/opendnd

tavernbot's People

Contributors

dependabot[bot] avatar jakethedev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tavernbot's Issues

Webpack Tavernlib for Static Site

I'd like to be able to run an npm script to build this and export it for a website. This could bring a lot of neat features to a page without having to duplicate code.

Could be a great chance to use Parcel

Content Generation Link Provider

Not sure how to approach this. There's interest in the idea of having a command, "!links param" or something, where the bot will reply with a few really great links for a thing.

Idea: Links are stored like { "url": "url.place.com", "tags": [ 'tag1', 'tag2', 'etc' ] }, and we should cache a list of each link per tag, so when a user inputs "!list npcna", it finds all 'npcname' links and replies with those.

Examples include things such as donjon.sh links, watabou city generator...

5e Funnel Character Generator

Talk to Abe, get the lowdown on how he sets that up, and replicate that functionality with the bot. Assuming he's cool with it.

Async Performance Thoughts

We should at least attempt to support async stuff. That sets a good foundation for scale in case people really like this bot

High Fantasy Hooks

The bot should be able to generate rpg hooks for high fantasy settings.

This is mostly done, we need more villains and descriptors, but the pieces are in place

Move Lookup

This is pretty specific to dungeon world, but could be pretty handy.

Music and Soundscapes

Can the bot play Sword Coast Soundscapes? Will the channel owner even let us do that?

We'll figure all that out another day. Dependencies should be set for this to work, but let's try to test with an MP3 or something from the pi to make sure

Spell SRD Lookup

Dig through SRDs for spells. Param one should be the system (5e, PF, fate, DW, AW, SR, etc), and if we have an SRD included in the app for it, run a search and return the spell info. Prefix search should be adequate

Input: !spell 5e fireball, !spell PF cure light
Output: Appropriate spell info or an informative error

Implement a Help system

Core: !help should list commands and what they need to run successfully.

Advanced: I think the best way might be to have each function return some help text when invoked with a single parameter of 'help'. This allows us to be consistent across the app, and to iterate all the loaded functions of tavernlib/discordlib/etc and just concat all the help stuff together for a global "!help all" command

Add Role Function

In the discordlib, we need to be able to add roles. Specifically, a user should be able to add a flair role for themselves, but an admin should be able to add roles to a user too.

No one should be able to grant escalation of rights, such as mod roles. Perhaps cache all mod roles on connect, and use that list to compare the requested role?

Remove Role

A user should be able to remove a role that they have, especially flair roles - perhaps we should consider when a mod tries to remove mod from themselves, but let's assume that won't happen initially

Summon command

!summon user
And the bot replies by tagging the user/role within a fancy summoning circle of ASCII art

Initiative Tracker

Brainstorm: How to get the bot to track an initiative order? It should only track one, but we want to build it with the idea in mind that multiple parallel games may be played on the server.

I think most trackers suck, and we can do better.

Input: !init Thordak 17, Gimli 19, Frodo 2, Shelob 11, Tracer 21
Output: Initiative is set! Tracer is up, Gimli is on deck!

Input: !init Dopey 3
Output: Dopey has joined the fray! Tracer is up, Gimli is on deck!

Input: !init
Output: Gimli is up! Thordak is on deck!

Input: !init list
Output: Char Name (Init value) in a vertical list, with an arrow pointing at the current initiative.

Input: !init clear
Output: The dust settles and the battle is over.

Basic Dungeon Generator

Figure out who said it - MT Black? - that there's a perfect formula for a dungeon. It was easy to replicate too: it's got an entrance, traps, loot, fights, secrets, and a boss. We could make a simple ascii map generator that prints out a legend with randomized attributes, giving us dungeons from 5 to like 20 rooms.

Various stats commands

!bot stats

Mostly just cus I think it's neat. Show system RAM% and, if implemented, roll macro usage. Show total dice rolled and commands requested over life of bot.

Inspired by rad admin panels: https://github.com/epicmaxco/vuestic-admin

UPDATE:
Using Supervisor to solve #47 will give us this, the bot just has to curl itself. Alternately, this would be fun to code...

Handy mod commands

Ideas include adding and deleting roles, kicking people, a funny no-impact banhammer command

Roll Macros in Discord

!macro monkPunch 1d20+7, 1d4 + 2 + 1d6

We want to stash good macros like this. Probably save the last 256 or so. Then we can roll them with

!macro monkP

Because prefix is life.

Magic 8 Ball

For those tough decisions. Could be fun to expand to like 40 or 50 responses

Input: !8 Should I attack the dragon?
Output: Most definitely

feature request: coin flip

!flip [n]

[n] is the (optional) number of flipped coins. The bot replies with the total number of heads and total number of tails. You may also want to specify a maximum number.

Sass joke cmd upgrade

!sass @user

Ideas include tagging the user in a sassy message, sassing the user and then muting them for 10 seconds, or random variants of a sass message. This would ideally be a decent gag and not an admin command, probably in the chatter.js file in discordlib (or whichever novelty code file replaces it someday)

Future ideas for sass: contact the owner of this and see if we can use these http://www.dmsguild.com/m/product/236600

Stop command

!youhavebeenterminated

This should cause the bot to stop, and we'll have a system mechanism that restarts it such as a cron job or a watchdog process (Resolved; #47) This command should be locked down to mods and bot admins.

Monster SRD Search

Monster generator can default to 5e I think, but that's not the easiest way forward. Param one should be the system (5e, PF, fate, DW, AW, SR, etc), and if we have an SRD included in the app for it, run a search and return a stat block

Input: !monster 5e adult red, !monster PF goblin
Output: Appropriate states from appropriate srd

Character and NPC generator Specs

Creating NPC/PC

  • class+spec (title only, no powers)
  • race+sub (include stat mods)
  • background from table
  • profs
  • stats
  • 2 knives by default
    • Knife theory table!

Low Fantasy Hooks

I want the bot to be able to generate hooks for low fantasy settings

Space-age Hooks

I want the bot to be able to generate hooks for futuristic space settings

Autostart and Reloading

We need an init script or something of the sort that we can enable to auto-start the bot on boot, and to reload the bot when code changes. That way we can cron a "git pull master" and have auto-updates work smoothly

Nodemon:
https://www.npmjs.com/package/nodemon
remy/nodemon#1176

Node service init.d creator:
https://www.npmjs.com/package/node-service-linux

PM2, could run a script that runs nodemon:
http://pm2.keymetrics.io/docs/usage/quick-start/

Could shorten this:
https://github.com/chovy/node-startup/blob/master/init.d/node-app

Init Automod Module

Certain filtering and ban actions can be automated, because not everyone is super civil at times

Ideas:

  • Word filters: Some are warnings, some are next-time-you're-banned, and some are autoban
  • Role/permission lockdown for banned people as an option instead of pure kicks

Awesome Dice Roller

In tavernlib, we want to be able to run dice and advanced queries with useful output. As discussed before, this needs to include subtraction support

input: !roll 1d20 +5, 2d6 + 3 - 1d4
Output: @UserThatRolled,
1d20+5: 17
2d6+3-1d4: 11 - 2: 9

Modern Hooks

I want the bot to be able to generate hooks for modern settings

NPC Name Generator

We want a damn good generator for core D&D races, and probably an additioanl category for rad villain names

Cyberpunk Hooks

I want the bot to be able to generate hooks for futuristic cyberpunk settings. We want to talk to some Shadowrun GMs for this stuff

Steampunk Hooks

I want the bot to be able to generate hooks for modern/future steampunk settings

Fate Character Generator?

First, figure out if there's an SRD to work with. Then, figure out if anyone can possibly use this. Finally, if all that lines up, set up a sweet little generator for new Fate characters

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.