A twitch bot with permissions, modules, access control, and many more features.
This bot requires a folder that isn't present, node_modules. The node_modules can be obtained after downloading nodejs and then running the commands tmi.js in a command line of your choice. The config.json file also needs to be modified before running this bot; the name, channels, and oauth variables inside that file need to be edited before being run.
Keep in mind that this process requires you to have Git.
In a command line of your choice, enter the following commands:
git clone https://github.com/iDiffusion/Adventure-Bot/to download the projectcd Adventure-Botto open the new project directory made by GitHubnpm install tmi.js --saveto install its dependenciesnpm install pm2 -gto install pm2, if you would like to run bot in the background.
Make sure to edit the config.json file before running the bot, it will not work unedited.
Keep in mind that this process requires nodejs and tmijs to be installed.
- Navigate to the Repository, if not already there.
- Click
Clone or downloadthenDownload ZIP. - Extract and open the folder.
- Within the folder press and hold
shiftandright-clickto open the options, then clickOpen CommandPrompt window here. - Type
npm install tmi.js --saveto install the bots dependencies. - Type
npm install pm2 -gto install pm2, if you would like to run bot in the background.
Before running the bot make sure that config.js has been setup properly, nodejs has been downloaded and installed, and tmi.js has been installed in the folder with the bot code. Also the bot must be modded, which will allow for fast responses and ensure the bot does not get timed out for messaging to fast (specifically when modifying players points, aka key-fragments).
- To run
start.batclick the executable file. - To run
startPM2.batmake sure that pm2 is installed and then click the executable file. - To initiate the adventure, type
!adventurein twitch chat. - To start the adventure, type
!explore fin twitch chat. - If you would like to see the current status type
!statusthen look at the CommandPrompt
The prompt.json file is formatted to make altering the story a breeze.
First, there are two variables within the file; one called totems which contain an array of totems and story which contain an array of elements (parts of the story). The first few elements in the story are adventure and explore, followed by the story.
Each element in story contains a path (path name), value (string to printed), connected (list of the next linked paths/choices), userPick (whether or not to stop and allow users to vote), runnable (which function to run when the path in called, i.e. giveKeys), and required (the name of the totem required if needed). For example:
{
"path": "1",
"value": "You have been lead to a fork in the road, do you take the !left or !right path?",
"connected": ["left", "right"],
"userPick": true,
"runnable": null,
"required": null
}
Each element in totems contains a path (name of the totem), and value (which is whispered to them when the variable, testing is enabled):
{
"path": "butterknife",
"value": "You have chosen to carry the Butter Knife"
},
{
"path": "locket",
"value": "You have chosen to carry the Locket"
},
{
"path": "book",
"value": "You have chosen to carry the Book"
}
The bot will work with an unfinished story but will not continue if it takes a path that is unfinished. If you have any questions, please feel free to ask.