Allows you to print Twitch messages in Factorio and send custom commands in Factorio, customizing them via Useful book. Fully customizable.
(Perhaps, I'm not going to develop it because there are issues with Python and TwitchIO etc. Also, I don't have enough followers etc. on Twitch to test some stuff like "rewards for points" etc.)
(It might work not so stable on Windows sometimes)
It is assumed that you have:
- Useful book - Factorio mod on the server
- AARR - Factorio mod on the server (optional, not important atm)
- Factorio or its headless server
- Twitch account for your bot
- Python 3.10 installed. (I didn't test it on any other version)
- Pip installed
python --version
pip --version
- After clone this repo, rename
config-example.toml
toconfig.toml
andUB_data-example.csv
toUB_data.csv
in configs directory. Open and changeconfig.toml
. - Change
UB_data.csv
and check/add your scripts in Useful book.
If you are hosting the game locally, instead of a dedicated server then follow these instruction. Otherwise if you already have a dedicated server, look up how to enable the RCON interface with a particular port and password.
- On the main menu screen, hold Ctrl+Alt and then left click "Settings"
- Now select the last item "The rest".
- By
local-rcon-socket
, enter127.0.0.1:25575
- By
local-rcon-password
, entermy_password
(or any secret password, the same one as in config.toml) - Then click confirm, and go back to the main menu.
- Click Multiplayer -> Host a save game
- Select the game you want to host.
- Click Play
For the bot, you may want to create a separate twitch account (alternatively you can just use your current twitch account). Note: you'll need Two-Factor Authentication (2FA) enabled for this step.
Go to https://dev.twitch.tv/ and login with this twitch account. Then click Your Console
->Register Your Application
.
Fill in the fields:
- name:
FactorioChatBot
- OAuth Redirect URLs:
https://twitchapps.com/tokengen/
- Category:
Chat Bot
Complete the reCAPTCHA and click save
at the bottom.
Copy the Client ID and paste it into config.toml
.
You can create "Virtual Environment"s to keep libraries from polluting system installs or to help maintain a different version of libraries than the ones installed on the system.
Execute the following commands in the main directory:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py
After that you'll need this to run the bot within the directory:
source venv/bin/activate
python main.py