Coder Social home page Coder Social logo

juanparker1 / sr1egamebot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nathanhawks/sr1egamebot

0.0 0.0 0.0 7.68 MB

A discord dicebot for SR 1e-3e which also does initiative and roll macros, and may someday have additional tools to help run Shadowrun 1st/2nd/3rd Editions over Discord.

JavaScript 99.99% Procfile 0.01%

sr1egamebot's Introduction

SR1eGameBot

What It Is

A Discord dicebot for SR1e/2e/3e, which does d6 rolls with modifiers, as well as Success Tests and Opposed Success Tests. It can also store dice macros, and even generates initiative for Shadowrun 1st-3rd Editions -- both forwards and backwards.

Instructions on using the bot are below, after the self-hosting instructions.

How to Install

Click here to deploy the bot on your server.

To self-host:

  1. Install node.js and test that it's working. You'll need this in order to set up the bot.

2a. Get your Discord auth token via the New Application button at http://discordapp.com/developers/applications/me and put the auth token in a discordauth.json file, in the same directory as main.js. The format:

{
"token": "your auth token string from the New Application button at http://discordapp.com/developers/applications/me"
}

2b. Get credentials for the Google side of the app by creating a new project at https://console.cloud.google.com/getting-started using the "Select a Project" button in the upper-left. (Choose "External" and "Desktop Application".) From here you will be able to export the JSON-formatted data for your Google Drive API login. Save this in the same directory as main.js under the filename googlecredentials.json.

  1. Run GameBot locally by going to its directory and running node . (with the period). Follow the instructions to authorize the bot as a Google app. By the time you're done you'll have authorized the bot to use its own private slice of your Google Drive (for storing settings like initiative and macros). When you paste the authorization code into the bot's console input, it will create and populate the file googletoken.json, in the same directory as main.js.
  • If you plan on self-hosting at home or pushing files to the web via FTP, you can skip to step #8.
  • If you plan on hosting via Heroku and deploying via GitHub, continue with the following steps:
  1. On your deployment server, create 3 environment variables:
  • GOOGLE_CREDENTIALS should have the contents of the googlecredentials.json file.
  • GOOGLE_TOKEN should have the contents of the googletoken.json file.
  • TOKEN should have the contents of the discordauth.json file.
  1. Publish your copy of the bot to your repo under the master branch.
  2. Link Heroku to your GitHub repo, and tell Heroku to auto-deploy when you push to master.
  3. In Heroku, under "Configure Dynos", use the "worker dyno", not the "web dyno".
  4. Invite the bot to your server! Replace the XX's in the following link with your bot's ID number: discordapp.com/oauth2/authorize?client_id=XXXXXXXXXXX&scope=bot&permissions=0

Gaining access to admin commands:

There are a few admin commands that are hard-coded only to respond to me, the bot's author. If you self-host, you can gain access to them:

  1. Find out your Discord ID (it's not your username followed by a few numbers; it's all numbers; it will be the third number that appears in your bot's logfile when you use any of the initiative commands).
  2. Do a find-and-replace in main.js, replacing all occurrences of my Discord ID, 360086569778020352, with your Discord ID.
  3. Push the changes and restart the bot.

Shadowrun Dicebot Features

🎲 Plain Old d6's 🎲

  • !X
    Roll Xd6 without Rule of 6
    example: !5
    rolls 5d6 without Rule of 6
  • !Xt
    Roll Xd6 and total them.
    example: !6t
    rolls 6d6 and adds them up.
  • !Xt +Z
    Roll Xd6, total them, and add or subtract a modifier.
    example: !6t -5
    rolls 6d6, totals them, and subtracts 5 from the total.

6️⃣ Rule of 6 & Target Numbers 🎯

  • !X!
    Roll Xd6 with Rule of 6
    example: !5!
    rolls 5d6 with Rule of 6
  • !X tnY
    Roll without Rule of 6 against Target Number Y
    example: !5 tn4
    rolls 5d6 w/o Rule of 6 vs TN4
  • !X! tnY
    Roll with Rule of 6 against Target Number Y
    example: !5! tn4
    rolls 5d6 w/ Rule of 6 vs TN4

🥊 Opposed Rolls 🥊

  • !A! tnB vsX! otnY
    Roll Ad6 (with Rule of 6) with tn B, opposed by Xd6 (with Rule of 6) with opponent's TN Y
    ➡️ vsX = the number of dice the opponent throws (vsX! for Rule of 6)
    ➡️ otnY = the opponent's target number
    example: !5! tn3 vs6! otn4
    Roll 5d6 (Rule of 6) with TN 3, against 6d6 (Rule of 6) with TN 4

🔢 Multiple Rolls per Message 🔢

You can order GameBot to do multiple rolls with one message. Just separate the dice commands with semicolons.

example: !1 ; 2t ; 3!; 4t +5 and a note for good measure

Be careful not to use semicolons for any other reason.

🏷️ Notes 🏷️

Notes are OK, and your options can be in the middle of the note.

examples:

  • !3! TN4 resist wagemage sorcery ⬅️ works
  • !3! resist wagemage sorcery TN4 ⬅️ works
  • !3! resist TN4 wagemage sorcery ⬅️ works
  • resist wagemage sorcery !3! TN4 ⬅️ won't work

⏩ Macros (Saved Rolls) ⏩

  • !save name dice_command_without_preceding_bang
    Creates or updates a named "dice command". (See all the sections above for valid "dice commands".)
  • !roll name
    Rolls the saved "dice command" with the given name.
  • !lm
    Lists your saved dice command macros for that channel.
  • !removemacro name or !rmm name
    Removes one of your saved macros in that channel.

♻️ Reroll ♻️

  • Anyone can click the 🎲 reaction to reroll any recent roll.
  • Remove and re-add your reaction to keep re-rolling that roll.

💥 EXPERIMENTAL: Initiative System 💥

Player setup:

1️⃣ !setgm @someone
2️⃣ !setinit X Y

GM setup:

1️⃣ !setgm
2️⃣ !setplayers @player1 @player2 (etc)
3️⃣ !setnpcinits (see below)

!setinit syntax is !setinit X Y where X is the number of dice and Y is the modifier. For example, !setinit 1 4 sets your initiative formula to 1d6+4.

IMPORTANT: Commands won't work unless you @people correctly. Use the menu that pops-up while you type, or tab-completion. If it's highlighted blue, you did it right.

🎲 Rolling Initiative 🎲

➡️ !init - Shadowrun 1e initiative
➡️ !initflip - Shadowrun 1e initiative, reversed
➡️ !init2 - Shadowrun 2e initiative
➡️ !init2flip - Shadowrun 2e initiative, reversed
➡️ !init3 - Shadowrun 3e initiative
➡️ !init3flip - Shadowrun 3e initiative, reversed

The bot remembers stuff; you won't need to redo setup, just update whatever changes. However:

  • Everything is linked to GM and chat channel.
  • If you move to a different channel, you must re-enter everything.
  • Multiple GM's can share a channel, but anyone playing in both groups must repeat their set-up steps (starting with !setgm).
  • To play in two games at the same time, you'll need two channels.

🎲 Other initiative commands 🎲

Shortcut  Full command    [Required] options
--------------------------------------------
          !setgm          @someone
!si       !setinit        [X Y]
!setp     !setplayers     [@player1 @player2 etc]
!addp     !addplayers     [@player1 @player2 etc]
!lp       !listplayers
!rmp      !removeplayers  [@player1 @player2 etc]
!clrp     !clearplayers
!setn     !setnpcinits    [X1 Y1 label1 X2 Y2 label2 etc]
!addn     !addnpcinits    [X1 Y1 label1 X2 Y2 label2 etc]
!ln       !listnpcinits
!rmn      !removenpcinits [label1 label2 etc]
!clrn     !clearnpcinits

🐲 Adding NPC's 🐲

!setnpcinits and !addnpcinits syntax:
!(command) X Y label
Labels cannot have spaces or commas. Add as many NPCs as you want, separated by spaces.

e.g. !addnpcinits 1 5 thugs (means the thugs have 1d6+5 initiative).

If you have multiple NPC's with the same label, !removeNPCInits also accepts the format !removenpcinits X Y label which requires a full match. But, having multiple NPC's with the same label is confusing anyway, so maybe just don't do that.

Misc

All initiative-related and macro-related commands are a little slow (due to communication with Google Drive). They get faster after the first use. The ⏳ reaction means it's working on your request.

Commands are not case-sensitive. Go WiLd WitH tHaT.

You can find my Patreon at https://patreon.com/nathanhawks if this bot helps you game.

Legal

This software is released as-is under the terms of the UnLicense; it is available to the public domain.

sr1egamebot's People

Contributors

nathanhawks avatar dependabot[bot] avatar

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.