Skip to content

Commit

Permalink
Initial Setup for Deploy
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jake authored and jake committed Jan 29, 2018
1 parent 864c32b commit 8e32d63
Show file tree
Hide file tree
Showing 8 changed files with 2,910 additions and 11 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
5 changes: 3 additions & 2 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ client.on('message', msg => {
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( 'Running dungeonary.'+cmd+' with input='+input+' for '+msg.author.username )
console.log( execTime + 'running dungeonary.'+cmd+'('+input+') for '+msg.author.username )
msg.reply( dungeonary[cmd]( input ) )
} else if ( cmd in discordlib ) {
console.log( 'Running discordlib.'+cmd+' with input='+input+' for '+msg.author.username )
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")
Expand Down
19 changes: 14 additions & 5 deletions discordlib/discordroles.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
require('discord.js')
// All commands should have the signature:
// f(input:String, message:discord.js#message, client:discord.js#client)

exports.addRole = function(client, user, role){
//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
return 'a role has no name';
}

exports.listRoles = function(client, user, role){
//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';
}

exports.removeRole = function(client, user, role){
//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';
}

exports.listUsersInRole = function(client, role){
//Number of people in a given role
exports.population = function(input, message, client){
//TODO Publicly visible, so anyone should be able to do this.
//Get all with role
// let roleID = "264410914592129025";
// let membersWithRole = message.guild.roles.get(roleID).members;
// console.log(`Got ${membersWithRole.size} members with that role.`);

}

samplecode = function(){
Expand Down
Loading

0 comments on commit 8e32d63

Please # to comment.