alduron / JackBot

A Discord bot for hosting JackBox Party Pack 4
34 stars 5 forks source link

NOTE

This project was originally created for my non-tech family to stay connected during COVID. I'm currently working on a few very demanding projects and do not have time to maintain this bot. I will continue to review and approve Pull Requests for issues if someone wants to keep it updated. I can also add a contributor if anyone is interested.

JackBot

A Discord bot for hosting all 8 of the Jackbox Party pack games

Details

This is not intended to be an official bot, this is just a project I threw together to help my family stay connected. There might be more sophisticated ways but this was a fairly quick project

What it is

JackBot is a hacky way to get a bot running and streaming games inside Discord. This can be beneficial if players are not in the same location and certain hosts do not have access to decent internet or a computer to run the game. It is intended to be hosted by someone with a little tech knowledge so the non-tech-savvy folks can enjoy these games if we're not available.

How it works

The premise is simple. Discord nor JackBox have native PowerShell integration so JackBot uses WScript to interact with the windows and navigate around the apps. It has a limited state capacity to keep track of its position inside the packs and apps at all times.

Does this work with other games

Technically it can work with any game that can be interacted with by keyboard commands. In its current form it only supports the JackBox Party Pack games. A kind individual has provided me with the rest of the Jackbox games which have now been integrated into the bot!

New Features

Updating to New Version

When updating to this newest version you will have to add the following line into your config.json file or AutomationTools will default the log file name.

"LogName":"JackBotLog",

Prereqs

You'll need a number of things to get this bot working correctly

Discord Account

Create a new Discord Account that the bot can use for hosting services. This account doesn't require any special permissions.

Discord Server

Create a new Discord server or use an existing one. The only requirement is that you have an account that has the Manage Server roll, this is required to add the bot later. You can create a new server with this tutorial.

Copy the server name for later, we'll need it as DiscordServerName

ServerSettings

WebHook

Discord API Bot

The bot will remain in the channel but we're only using it to read messages. It's far easier to use webhooks for displaying messages.

BotID

BotToken

BotToScopes

SelectReadMessages

AddBotToServer

Discord Channel ID

The Channel ID can be retrieved in the UI by enabling Developer Options.

DiscordSettings

DiscordDevMode

CopyChannelID

Windows Settings

I'm running my bot on a Windows 10 VM on a spare machine I have in my house. The VM is running in VirtualBox as a service. It's important that whatever box you run the bot from is not running much of anything else. Definitely DO NOT run it on your normal-use machine. It will continuously grab your primary focus window.

I won't go into setting up and running the VM as that's outside the scope of the bot, but I'll give a few key details that need to be set if you're running inside a VM:

No matter which machine you run it on, you need to ensure the following settings are set. These are well documented so I won't reinvent the wheel:

You will need to install and log into the following items

KeyBind

Configuring the bot

Once all of the above items are in line you should be ready to configure and run the bot. You'll need the items we've gathered up until now to fill out the config.

  1. Download the files and unpack them to wherever you'd like the bot to run from. I've added path agnostic bat files so the location should not matter.
  2. Once downloaded copy ConfigTemplate.JSON, and rename it to Config.JSON.
  3. Update DiscordChannelName with the name of the channel the bot will be streaming to.
    • Example: general
  4. Update the DiscordServerName with the name of the Discord Server the bot will be streaming to.
    • Example: GameHost
  5. Update the DiscordTextChannelID with the DiscordTextChannelID we gathered earlier.
    • Example: 555555555555555555
  6. Update the DiscordToken with the DiscordToken we gathered earlier.
    • Example: LKAJSHDLJAS_lakjshdliASD_olkjbsdlkhjASDlkjasbdjhGLKJ.DHblkasjd
  7. Update the DiscordHook with the DiscordHook we gathered earlier.
    • Example: https://discordapp.com/api/webhooks/555555555555555555/kljhasd098uasDPOIASD897asiudhkjhbasd0AS&d9*ASYdijbsad
  8. Place the desktop link created by Steam (The Jackbox Party Pack 4.url) for each Jackbox game into the JackBot\links folder
  9. Place the shortcut to Discord (named Discord.lnk) inside the JackBot\links folder
  10. Create a Windows Task to run JackBot.bat inside the bot folder.
  11. Double Click JackBot.bat to start the bot manually.

Configurable options in the config file

Field Name Description Example
BotName The Display name of the bot, used for messages and the command list JackBot
LogName The name of the log file that will be generated, this is now controlled by AutomationTools JackBotLog
TriggerKey The trigger word the bot responds to !jackbot
CommandProcessConfirmation Option to notify when each command has finished processing true
CommandLockEnabled Enable to use the Command Lock feature at startup true
LockMinutes The number of minutes a lock will be maintained for 30
DiscordChannelName The name of the channel the bot will stream to general
DiscordServerName The name of the server the bot will connect to GameHost
DiscordLink The windows path the bot will run Discord with C:\\Path\\To\\Discord.lnk
AvailableGames\Link The link that the bot will use to launch the corresponding Jackbox game C:\\Path\\To\\Pack.url