To develop the Bot. Ensure you have your .env
file properly setup. Then you can run
make bot-run
from the project root to run the Bot. Unfortunately, this does not
support auto-restarts on code changes. You'll have to re-run this command on each code
change.
It can be hard to develop with the bot as it actively reads form the SaltyBet chat. It is recommended to have the bot run once you feel it is ready locally for at least the entire length of a SaltyBet modes. ie. Let it run a full cycle through Matchmaking, Tournament, and Exhibition. To ensure the bot works as expected.
Note: Twitch does not like two of the same user to be logged into a single chat room multiple times at the same time. Therefore if you have SaltyBet open in a different window it is highly advisable that you run SaltyBet in a session where you are not logged into Twitch currently to avoid any weird interactions and the bot randomly crashing.
The Web service is a simple Flask application. To develop with it however, you'll need
a PostgreSQL database dump. To get one please just ping me and I'll generate you a dump
at my earliest convenience. Then leverage psql
command to load up your database.
Alternatively, run a local Bot instance to start filling up the database with
live data for you.
To develop with Chrome Extension. You'll want to modify the necessary source code under
applications/extension/src/
. You can then run
make run-extension
which will just call npm run dev
under the hood. This will take
any code under the Extension's source directory and compile it into individual files
under applications/extension/dist/
. Very important
to note to not edit any of these files! From here you can then run the Extension from
these local files:
- Navigate to
chrome://extensions
in Chrome. - Ensure you have "Developer Mode" enabled in the top right of this page.
- Click on "Load Unpacked".
- Find the
dist
directory in the file explorer and select it.
The Extension should now be working when you go to https://saltybet.com. When you update
the extension click on the "Update" button under the card for your local extension in
chrome://extensions
. Note that you may also need to refresh the SaltyBet web page.
The extension is hard-coded to reach out to https://salty-boy.com. However, should you
want to use a local instance you'll need to edit the SALTY_BOY_URL
accordingly in
main.js
.
If you have a local extension running to disable the live SaltyBoy extension, if installed, to avoid them from colliding with each other.
Note that depending on your changes you may also need to update either:
manifest.json
, and or
webpack.config.js
depending on any file
structure changes to ensure your files are getting built and thrown in
dist/
.
If your goal is just create a new betting method please read the above then do the following:
- You can create a new betting method by creating a new file under the
bet_modes/
directory. Create a function in that file that takes in thematchData
object and returns an object of the following format:{ "confidence": <value between 0 to 1>, "colour": <"red"|"blue"> }
- Import the function in
main.js
and add it to theBET_MODES
constant variable. - Update
popup.js
BET_MODE_INFO
constant variable accordingly. - Add the new bet mode as an option inside of the dropdown in
popup.html
.
To build the extension formally into a .zip
that can be submitted to the Chrome
Extensions Web Store, do the following:
- Update the version
manifest.json
accordingly. - Build the extension:
- On Linux (WSL):
- Run
make build-extension
- Run
- On Windows:
- Install 7-Zip and make sure it is in your Windows Path:
- Install 7-Zip.
- Open up a Command Prompt or Powershell window:
- Win Key + R.
- Type
cmd
then hit Enter.
- Update your
PATH
variable:set PATH=%PATH%;C:\Program Files\7-Zip\
- You can confirm your path by running
7z --help
. - You may need to update the above command if you installed 7-Zip elsewhere on your system.
- You can confirm your path by running
- From the extension root under
applications/extension
runnpm run build-win
.
- Install 7-Zip and make sure it is in your Windows Path:
- On Linux (WSL):
- A file name
saltyboy.zip
should be generated underapplications/extension
. This is the final packed extension.