Chatterino 2 is a chat client for Twitch.tv. The Chatterino 2 wiki can be found here. Visit the original repository here. Chatterino Red allows you to use a other process as a proxy for the chat.
Current releases are available at the releases tab.
To get source code with required submodules run:
git clone --recurse-submodules https://github.com/dodaucy/chatterino-red.git
or
git clone https://github.com/dodaucy/chatterino-red.git
cd chatterino-red
git submodule update --init --recursive
Building on Windows with vcpkg
Chatterino Red uses a JSON file for configuration that is located in the Chatterino Settings folder. The Chatterino Settings folder is located at:
On Windows: %APPDATA%/Chatterino2
On Linux: $HOME/.local/share/chatterino
On Mac: $HOME/Library/Application Support/chatterino
Open this folder and create a file called red_settings.json
. The file should contain a proxy_url
key with the url of the proxy as value. For example:
{
"proxy_url": "http://127.0.0.1:8000"
}
The proxy should be a HTTP server that simply waits for a POST request at the configured URL. The request contains JSON data with the following keys:
-
channel
: The channel name -
message
: The actual message
You can then do whatever you want and return an action as an response. The response should be a JSON object with one of the following actions as a value for the action
key:
-
send
: You need to return achannel
andmessage
key with the channel and message you want to send. You can easily use the original channel and message when you want to send the message normal. -
ignore
: You can ignore the message by returning this. -
system_message
: You can send a system message by returning amessage
key with the message you want to send. This message will be sent in the Chatterino Client.
You need to install pip install fastapi[all] pydantic
/ pip3 install fastapi[all] pydantic
to run this example with py -m uvicorn SCRIPT_NAME:app
/ python3 -m uvicorn SCRIPT_NAME:app
.
from fastapi import FastAPI
from pydantic import BaseModel
class Message(BaseModel):
channel: str
message: str
app = FastAPI()
@app.post("/")
def index(message: Message):
print(f"{message.channel}: {message.message}")
if message.message == "Please ignore me":
# Ignore the message
return {
"action": "ignore"
}
elif message.message.startswith("!system "):
# Send a system message
return {
"action": "system_message",
"message": message.message.split(" ", 1)[1]
}
else:
# Send the message to the channel
return {
"action": "send",
"message": message.message,
"channel": message.channel
}