Skip to content

Commit

Permalink
# This is a combination of 2 commits.
Browse files Browse the repository at this point in the history
# The first commit's message is:

# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 5 commits.
# The first commit's message is:
# This is a combination of 5 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 9 commits.
# The first commit's message is:
# This is a combination of 4 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 14 commits.
# The first commit's message is:
# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 45 commits.
# The first commit's message is:
Test commit

# The 2nd commit message will be skipped:

#	Test

# The 3rd commit message will be skipped:

#	Init a basic random lib, it can roll dice now. Starting point for the actual bot

# The 4th commit message will be skipped:

#	Framed bit of json for config

# The 5th commit message will be skipped:

#	Adding general todo, this will likely form up as github issues

# The 6th commit message will be skipped:

#	Adding more sources of dice rollers

# The 7th commit message will be skipped:

#	More todo info

# The 8th commit message will be skipped:

#	Adding package.json

# The 9th commit message will be skipped:

#	Started rolling

# The 10th commit message will be skipped:

#	Initial code bits for bot. Nuked python unnecessary stuff, tweaked a couple files to fit node stuff better. Still needs some conversion

# The 11th commit message will be skipped:

#	Initial setup for various commands

# The 12th commit message will be skipped:

#	Tweak todo

# The 13th commit message will be skipped:

#	Basic framework for mvp fleshed out, function stubs for catarns ranks, dice hella simplified.

# The 14th commit message will be skipped:

#	Converted adventure generator to node!

# The 15th commit message will be skipped:

#	Last tweaks and it works

# The 16th commit message will be skipped:

#	Fixed name, hooked into bot

# The 17th commit message will be skipped:

#	Lots of bot updates, runs for sure and works on a default channel and DMs. Easily configurable for now, will be easier to configure later

# The 18th commit message will be skipped:

#	Tweak to bot, added tons of boilerplate to roleslib that should make it trivial to build up mvp

# The 19th commit message will be skipped:

#	Adding link to roles

# The 20th commit message will be skipped:

#	Adding a bunch of python templates

# The 21st commit message will be skipped:

#	Update README.md

# The 22nd commit message will be skipped:

#	Overhaul with spellbook and monster SRD added, all custom libs renamed to better things.

# The 23rd commit message will be skipped:

#	Several tweaks and fixed. Huge update to adventuregen, we now have a skeleton for multisetting support. WOO

# The 24th commit message will be skipped:

#	Updating libs to use new and easier export structure, tiny tweak to default config

# The 25th commit message will be skipped:

#	Fixed the rest of the exports, this should make it easy to set everything up as one library. Bot updated to use new api

# The 26th commit message will be skipped:

#	Tweaks on input parsing to make sure we're handling it right

# The 27th commit message will be skipped:

#	Comments and a final input tweak

# The 28th commit message will be skipped:

#	Added a bit of example code for iterating exports to find a function

# The 29th commit message will be skipped:

#	Nix todo, keeping that elsewhere - switch to a notepad

# The 30th commit message will be skipped:

#	The first semblance of testing and proper npm script handling

# The 31st commit message will be skipped:

#	Update default config structure

# The 32nd commit message will be skipped:

#	Cleaning up config items in bot.js

# The 33rd commit message will be skipped:

#	Refactored for easy function addition, so now we go on to building the discord lib

# The 34th commit message will be skipped:

#	Init tavernlib's package.json, will take it out eventually and kick it to NPM

# The 35th commit message will be skipped:

#	Updating package for nodemon

# The 36th commit message will be skipped:

#	Basic testing complete, npm run test will fire off a series of mock messages against all current functions of rpg lib

# The 37th commit message will be skipped:

#	Tiny tweak

# The 38th commit message will be skipped:

#	Tweak to bot output

# The 39th commit message will be skipped:

#	Updating readme.

# The 40th commit message will be skipped:

#	Update README.md

# The 41st commit message will be skipped:

#	Moved notes to Readme, quick peruse through NPM for info on active rpg utils

# The 42nd commit message will be skipped:

#	Removing package lock

# The 43rd commit message will be skipped:

#	Tweak to readme

# The 44th commit message will be skipped:

#	Merge from Dev
#
#	Readmes, a rename, and a couple basic tweaks
#
#	Commit log:
#
#	* Update README.md (#7)
#
#	* Updating package json
#
#	* The bot shall be TavernBot! And the rpg-catchall shall be the dungeonary, like a dungeon dictionary!
#
#	* Readme tweak
#
#	* Renaming everything to tavernbot
#
#	* Package tweak
#
#	* Locking in the npm registry key, we've published tavernbot and dungeonary to npm - this closes #5
#
#	* Test
#
#	* Updating readmes and tavernbot package file
#
#	* Version bump for docs
#
#	* formatting
#
#	* a space of formatting
#
#	* Better coin message

# The 45th commit message will be skipped:

#	Initial Setup for Deploy
#
#	Here we go... Below is the super useful commit log
#
#	* Update README.md (#7)
#
#	* Updating package json
#
#	* The bot shall be TavernBot! And the rpg-catchall shall be the dungeonary, like a dungeon dictionary!
#
#	* Readme tweak
#
#	* Renaming everything to tavernbot
#
#	* Package tweak
#
#	* Locking in the npm registry key, we've published tavernbot and dungeonary to npm - this closes #5
#
#	* Test
#
#	* Updating readmes and tavernbot package file
#
#	* Version bump for docs
#
#	* formatting
#
#	* a space of formatting
#
#	* Better coin message
#
#	* Tweak to bot and test output, logging timestamps now. Roles stubs cleaned up and template-ized
#
#	* Ignore python stuff cus it's not part of this project
#
#	* Package lock and service idea
#
#	* Updated run scripts and gitignore

# The 2nd commit message will be skipped:

#	Updating package json

# The 2nd commit message will be skipped:

#	Locking in the npm registry key, we've published tavernbot and dungeonary to npm - this closes #5

# The 2nd commit message will be skipped:

#	Test

# The 3rd commit message will be skipped:

#	Version bump for docs

# The 2nd commit message will be skipped:

#	a space of formatting

# The 3rd commit message will be skipped:

#	Better coin message

# The 4th commit message will be skipped:

#	Tweak to bot and test output, logging timestamps now. Roles stubs cleaned up and template-ized

# The 5th commit message will be skipped:

#	Ignore python stuff cus it's not part of this project

# The 6th commit message will be skipped:

#	Package lock and service idea

# The 7th commit message will be skipped:

#	Updated run scripts and gitignore

# The 8th commit message will be skipped:

#	Package update

# The 9th commit message will be skipped:

#	Basic daemon script, enough to get moving with

# The 10th commit message will be skipped:

#	Dice roller tweak to not collide with other roller

# The 11th commit message will be skipped:

#	Daemon tweaks

# The 12th commit message will be skipped:

#	Daemon tweak

# The 13th commit message will be skipped:

#	Readme tweak.

# The 14th commit message will be skipped:

#	Roleslib is now loading, and rolesize works

# The 2nd commit message will be skipped:

#	Updating package json

# The 2nd commit message will be skipped:

#	Locking in the npm registry key, we've published tavernbot and dungeonary to npm - this closes #5

# The 2nd commit message will be skipped:

#	Test

# The 3rd commit message will be skipped:

#	Version bump for docs

# The 2nd commit message will be skipped:

#	a space of formatting

# The 3rd commit message will be skipped:

#	Better coin message

# The 2nd commit message will be skipped:

#	Ignore python stuff cus it's not part of this project

# The 3rd commit message will be skipped:

#	Package lock and service idea

# The 2nd commit message will be skipped:

#	Package update

# The 2nd commit message will be skipped:

#	Dice roller tweak to not collide with other roller

# The 2nd commit message will be skipped:

#	Daemon tweak

# The 3rd commit message will be skipped:

#	Readme tweak.

# The 4th commit message will be skipped:

#	Roleslib is now loading, and rolesize works

# The 2nd commit message will be skipped:

#	Daemon tweak

# The 3rd commit message will be skipped:

#	Daemon update, should be last one

# The 4th commit message will be skipped:

#	Ignore this commit

# The 5th commit message will be skipped:

#	New discord sublib called chatter

# The 6th commit message will be skipped:

#	Beta summoning function

# The 7th commit message will be skipped:

#	First try at summon, committing tweak to bot config for multichannel

# The 8th commit message will be skipped:

#	semver bump

# The 9th commit message will be skipped:

#	semver bump actual this time

# The 2nd commit message will be skipped:

#	Service scripts (#54)
#
#	* Nuke old daemon script
#	* Service dir with test scripts for running live - progress on #38 and #47

# The 3rd commit message will be skipped:

#	Systemd unit should be complete, updated service use instructions with basic notes

# The 2nd commit message will be skipped:

#	Package cleanup + lock update

# The 3rd commit message will be skipped:

#	Nodeenv output to verify #38

# The 2nd commit message will be skipped:

#	Daemon update, should be last one

# The 2nd commit message will be skipped:

#	Fixing service script so its run as npm to deliver package props for gravemind lib

# The 3rd commit message will be skipped:

#	Script that should do the trick for #63 but we need to test it

# The 4th commit message will be skipped:

#	Perms on autoup script

# The 5th commit message will be skipped:

#	Cleanup on autoupdate script

# The 2nd commit message will be skipped:

#	Updating service dir with update script and clean docs, killing init script

# The 3rd commit message will be skipped:

#	Default issue markdown file

# The 4th commit message will be skipped:

#	Amending commit - readme update

# The 5th commit message will be skipped:

#	Rename DefaultIssueFormat.md to ISSUE_TEMPLATE.md

# The 2nd commit message will be skipped:

#	Readme update with importerror fix

# The 3rd commit message will be skipped:

#	Fixed typo, added helpful cron entries

# The 2nd commit message will be skipped:

#	Comment

# The 2nd commit message will be skipped:

#	Dungeonary version bump for npm update:

# The 2nd commit message will be skipped:

#	Fixing readme links after transfer
  • Loading branch information
Jake authored and jakethedev committed Jul 6, 2018
1 parent 89158b8 commit a948d44
Show file tree
Hide file tree
Showing 39 changed files with 26,280 additions and 229 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
py-generators/* linguist-vendored
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ typings/
# dotenv environment variables file
.env

.config
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
13 changes: 13 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Expand here on your title, unless the title is clear enough. Please delete any template lines that you aren't using - note that this is a suggested format, and though it's nice, you're not bound to it :)

### Bug Alert
- What is the issue?
- How do we replicate it?
- How many donuts will you send if we fix it now instead of backlogging it?

### Feature Request
- What should the feature do?
- Is it for gaming, for discord admins, or for fun/novelty?

### Idea, Question, Suggestion?
Feel free to adlib here!
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017
Copyright jakerunsdnd (c) 2017-2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

82 changes: 38 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
# DungeonBot
# TavernBot - The Ultimate RPG Discord Bot for D&D, Pathfinder, and beyond!
### [Ideas and Suggestions Welcome!](https://github.com/jakethedev/tavernbot/issues)

A generator bot for Game Masters of D&D. Multiple run modes include
a flask API (WIP), a discord bot (WIP), and a CLI for 'that' GM (aka me).
The idea: Wouldn't it be hella dope 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](https://www.npmjs.com/package/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.

### Notable issues:

#### 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.

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](https://github.com/jakethedev/tavernbot/issues) and we'll get it prioritized :D

---

## Notes from before:

Need to implement this:
https://github.com/Rapptz/discord.py#discordpy

This bot is twinkle in the eye of a bud of a work in progress.

But the idea is that is would be hella dope to have a D&D bot for discord, yeah?

I think so. So here's an attempt at building that.

# Todo List ('scuse the shorthand)

Main Func
- Run script for bot
- Run script for server
- Combine?
- local main, enum param for what to make
- enum: adventure, quest, hook, bbeg, bg, npc, party

Major Tasks
- Hook randomizing
- Fall into dungeon
- Witness crime
- Npc informant found out defector
- Villain and subvillains
- Create subvillain generation
- Have 2-3 allies for main villain
- Creating NPC/PC
- class+spec (title only, no powers)
- race+sub (include stat mods)
- background from table
- profs
- stats
- 2 knives by default
- Knife table
- Create party
- param: size, stats=random,spread
- gen (size) pc's, roll/spread stats
- size-1 bonds for each pc
- set up a bond table to roll on
Source for dungeon world content: https://www.npmjs.com/package/dungeonworld-data

#### Additional Notes:Discord Bot Thoughts and Ideas
Throttle max rolls to 100. If more, mutiply to match and throw another 100 on it.
Cap dice types at 5 instances of 'd'? "Error: Too complex"?
I want to roll this '1d20 + 5, 2d6 + 2d8 + 3'

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

Character stats implementations
- PHB spread w/stat priority per class
- 4d6k3
- Colville method
- 6 + 2d6

Keep last 128 macros? 256?

Find a good base of Character Sheet JSON

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




47 changes: 47 additions & 0 deletions bot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//All the custom stuff, separated by converns
const dungeonary = require('./dungeonary')
const discordlib = require('./discordlib')

const Discord = require("discord.js")
const client = new Discord.Client()
const { token, botkey, defaultChannel, gameStatus } = require("./config.json")

// In case something happens, we'll want to see logs
client.on("error", (e) => console.error(e))

// Startup callback
client.on('ready', () => {
if (process.env.NODE_ENV) console.log(`${process.env.NODE_ENV} mode activated!`)
console.log(`I'm rolling initiative as ${client.user.tag}!`)
client.user.setPresence({
"status": "online",
"game": { "name" : gameStatus }
})
})

// Command central
client.on('message', msg => {
// Let's hook it up for a default channel and DMs
if ( msg.channel.name == defaultChannel || msg.channel.recipient ){
//Make sure we care, and that we're not making ourselves care
if ( !msg.content.trim().startsWith(botkey) || msg.author.bot) return
//Remove botkey and break it up into clean not-mixed-cased parts.
let parts = msg.content.trim().toLowerCase().substring(1).split(/\s+/)
let cmd = parts[0]
let input = parts[1] ? parts.slice(1).join(' ') : '' //Some cmds have no input, this lets us use if(input)
let exectime = new Date(Date.now()).toLocaleString() + ': ';
//From here, we check each lib until we find a match for execution, or we let the user know it's a no-go
if ( cmd in dungeonary ) {
console.log( execTime + 'running dungeonary.'+cmd+'('+input+') for '+msg.author.username )
msg.reply( dungeonary[cmd]( input ) )
} else if ( cmd in discordlib ) {
console.log( execTime + 'running discordlib.'+cmd+'('+input+') for '+msg.author.username )
msg.reply( discordlib[cmd]( input, msg, client ) )
} else {
msg.reply("I'm sorry "+msg.author.username+", I'm afraid I can't do that")
}
}
});

// Turning the key and revving the bot engine
client.login(token);
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"token": "keep it secret, keep it safe",
"botkey": "!",
"defaultChannel": "golemworks",
"activeChannels": ["golemworks", "bot", "todo implement this"],
"gameStatus": "several RPGs at once"
}
28 changes: 0 additions & 28 deletions discord/client.py

This file was deleted.

Empty file removed discord/init.py
Empty file.
26 changes: 26 additions & 0 deletions discordlib/chatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
exports.sass = function(input){
return 'ain\'t nobody got time for that'
}

exports.summon = function(input, message){
if (message.mentions.users && message.mentions.users.size > 0){
let targetToSummon = message.mentions.users.first()
let response = `Throwing a salt circle...
\`\`\` %%% %%%
%%% %%%
%%% %%%
%%% %%%
${targetToSummon}
%%% %%%
%%% %%%
%%% %%%
%%% %%%\`\`\``
return response
}
return 'you can\'t just summon nothing, that\'s not how this works!'
}
68 changes: 68 additions & 0 deletions discordlib/discordroles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// All commands should have the signature:
// f(input:String, message:discord.js#message, client:discord.js#client)

//Given a rolename as input, add it to the requestor if it doesn't result in new privileges
exports.addrole = function(input, message, client){
//TODO Ensure requestor is admin or the user, then add role to user
// if ( role.position < bot.role.position ) { ok }
return 'a role has no name';
}

//List the requestor's roles
exports.roles = function(input, message, client){
//TODO Return a list, could be empty so return something pleasant
return 'your role is to butter toast';
}

//Self-remove a role
exports.unrole = function(input, message, client){
//TODO Ensure requestor is admin or the user. Then remove role if exists.
return 'by your decree, we have banished you from the cool kids club';
}

//Number of people in a given role
exports.rolesize = function(input = '', message, client){
if (!input) return 'there are many members with many roles, give me a role and I\'ll give you an answer';
if (message.guild.available) { //Docs recommend this check

//Make input easier to search with, comb the roles, and return the size of the role if it's found
input = input.trim().toLowerCase();
let roleResult = message.guild.roles.find( role => role.name.toLowerCase() === input);
if (roleResult){
let roleCount = roleResult.members.size;
return `there are ${roleCount} members in ${roleResult.name}`;
} else {
return 'role not found - enter the role\'s full name to get you a member count';
}
} else {
return 'there was a temporal anomaly, I believe I need my oil changed';
}
}

samplecode = function(){
// get role by name
let myRole = message.guild.roles.find("name", "Moderators");

// assuming role.id is an actual ID of a valid role:
if(message.member.roles.has(role.id)) {
console.log(`Yay, the author of the message has the role!`);
} else {
console.log(`Nope, noppers, nadda.`);
}

//Other basics


// Let's pretend you mentioned the user you want to add a role to (!addrole @user Role Name):
let member = message.mentions.members.first();

// or the person who made the command: let member = message.member;

// Add the role!
member.addRole(role).catch(console.error);

// Remove a role!
member.removeRole(role).catch(console.error);

//Docs https://anidiotsguide.gitbooks.io/discord-js-bot-guide/information/understanding-roles.html
}
15 changes: 15 additions & 0 deletions discordlib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// List all local components here
const components = [
'./discordroles',
'./chatter'
]

// Go through each chunk of the library and set each exported
// function as its own export of this module
for (sublib of components){
let lib = require(sublib)
for (operation in lib){
exports[operation] = lib[operation]
}
console.log( sublib + " loaded!" )
}
1 change: 1 addition & 0 deletions dungeonary/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
35 changes: 35 additions & 0 deletions dungeonary/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Dungeonary - The Ultimate Gamemaster and D&D Utility Lib
### Ideas or suggestions? [Drop an issue on Github](https://github.com/JakeRunsDnD/tavernbot/issues) and I'll do my best to add it!

It's like a library but magic!

This is a core component of the [TavernBot](https://github.com/JakeRunsDnD/tavernbot) project. This library is constantly being updated with fresh SRD content for various RPGs, and is
intended as a general-use RPG library. Dungeonary is made up of the following pieces:

### Working Components:
- adventuregen.js: An adventure hook generator, a lazy GM's best frienst! It has content and solid adventure
generation for high fantasy adventures, and it has stubs for Low Fantasy, Modern, Space, Cyberpunk, and Steampunk
settings. I plan to implement them all and continually update the options available.

### In-progress Components:
- diceroller.js: Pretty straightforward, my goal here is the smallest and fastest comprehensive
dice roller. It will be able to handle queries like "2d20k1+5, 5d6+5-2d4" as a single input, and return
output in array and sum form
- beastiary.js: Monster lookup! I currently have SRD info for 5e and Pathfinder, but I still have
to get searching and formatting complete. Then we'll have a great monster lookup tool that can be
implemented anywhere, from Discord to a Blog!
- spellbook.js: Same thing as beastiary.js but with spells.

### Future Components:
- quest.js: For general and flexible session-sized-adventure generation! When you have an arc and
you're grasping at straws for what an NPC needs the PCs to do, quest.js will be there to help
- pc.js: Gimme characters! This will initially support simple 5e level 1 generation based on the
official SRD, and will expand to include Pathfinder and other systems. This will also support
creation of [funnel characters!](https://rpg.stackexchange.com/a/51229/31197)
- npc.js: Gimme npcs! Always a handy tool, no rpg library is complete without a proper npc generator.
This library will also handle name generation
- feats.js: A feat lookup system could be neat
- Dungeon world/Fate/Other System support: I'd like to add srd support for fate, DW, and several other
systems in the spell and monster lookup and character generation

Note: This is currently an 0.x release, expect in-progress components to be fully fleshed out by 1.0. I'm pouring free time into this project, so hopefully that's soon :)
Loading

0 comments on commit a948d44

Please # to comment.