FishBot
A Discord Bot made for Tap Titans 2. Automatically parses google spreadsheet for statistics and has tournament timer. Works together with FishBotScripts, a suite of scripts that updates your own database and spreadsheet from game files.
Why the name FishBot you might ask? Because it's based on my game name, Fish and Chips.
Pull requests and feedback are always welcomed!
Table of Contents
Prerequisites
- You need to have an spreadsheet template that's exactly like this one: https://docs.google.com/spreadsheets/d/1SL5xFhLK9cAyjd53GJ1CYyV-GDDT3gr4Mjv0su8EpxM/edit?usp=sharing. The bot reads directly off the spreadsheet with this exact template.
- Obtain all the credentials needed for Configuration.
- You can also customize the bot by directly modifying the source code, but realize that if you're planning on using FishBotScripts, you will need to modify FishBotScripts accordingly as well.
Set Up
To get set up, you need to install the dependeicies in package.json and create some configuration files for your tokens, api key, and spreadsheet id.
Node.js and Npm
- If you don't have
node.jsnornpm, you need to install them first.npmis the package manager for node.js. - Now that you have
npm. Donpm installto install all the needed dependecies. Most importantly, this should installfirebaseanddiscord.jsfor you.
Configuration
- Create a
configfolder and the following files inside:config.jsonandfirebaseConfig.js. googleSpreadsheetApiKeyis obtained via Google's spreadsheet API. You have to have a google account to set up the credentials.spreadSheetIdis the id of your google spreadsheet.tokenis the bot token that you obtained from creating a bot user on your discord app.prefixis just any prefix you want the command to recognized.- To obtain the credentials for
firebaseConfig.js, you need to create a firebase app first and then you can find all of your credentials.
Example config.json
{
"googleSpreadsheetApiKey": <your key>,
"spreadSheetId": <your google spreadsheet id>,
"token": <your bot token>,
"prefix": <your command prefix>
}
Example firebaseConfig.js
const firebase = require("firebase");
const config = {
apiKey: <your key>,
authDomain: <your domain>,
databaseURL: <your database url>,
projectId: <your project id>,
storageBucket: <your url>,
messagingSenderId: <your id>
};
firebase.initializeApp(config);
const database = firebase.database();
module.exports = {
database: database,
}
Firebase
- I use firebase database to keep track of the tourament rotations, so the bot knows the rewards and the type of the tournament requested.
- There is a cron job set up in
command/tournamentCommand.js. Since cron job doesn't take UTC time, you might have to modify it to your local time equivalent of12:00 AM UTC Wednesday and Sunday
Example Firebase Database
{
"tournament" : {
"rewardCounter" : 2,
"typeCounter" : 8
}
}
Usage
To run the bot: node bot.js
Hosting: you can either host it locally whenever you need it or host it on a remote server, so the bot is on 24/7. For remote hosting options, I recommend Heroku(free, if this is the only application) or DigitalOcean(monthly charged).
Commands
{prefix}weekly_stats - displays a weekly statistics from a google spreadsheet
{prefix}curr_tour - displays information (type, rewards, time remaining) about the current tournament if there is one.
{prefix}next_tour - displays information (type, rewards, time remaining) about the upcoming tournament.
{prefix}my_stats - displays your stats.
{prefix}top_damage [number] - displays the top number damage dealers in clan quests.



