Jean Lapostolle 637667f9f2 | 2 years ago | |
---|---|---|
twason | 2 years ago | |
.gitignore | 2 years ago | |
Dockerfile | 2 years ago | |
LICENSE.md | 3 years ago | |
README.md | 2 years ago | |
config.json.dist | 3 years ago | |
docker-compose.yml.dist | 3 years ago | |
icon.png | 3 years ago | |
icon.svg | 3 years ago | |
logo.png | 3 years ago | |
logo.svg | 3 years ago | |
poetry.lock | 2 years ago | |
pyproject.toml | 2 years ago |
Twason is an opinionated Twitch chatbot created with the KISS principle in mind. It is based on the IRC protocol and is configurable in just one JSON file.
Twason is a portmanteau based on two words: Twitch (the platform the bot is designed for) and Jason (as the JSON file that you use to configure it).
Currently, Twason has the following features:
More features will be available in the future.
Twason is currently in development and may contain bugs, but it is globally usable. Actually, I’m using it on my Twitch channel.
The simplest (and safest) way to use it is to use the Docker image: deuchnord/twason
.
A Docker-Compose file is also available for facility.
To enable the bot to connect to Twitch chat, you will need to generate a token. Head to the Twitch Chat OAuth Password Generator and follow the instructions to generate it.
Then, you will need to give it to the bot through the TWITCH_TOKEN
environment variable.
To configure the bot, you will need to create a JSON file in config/config.json
as defined in the docker-compose.yml
file.
You can find a minimal configuration in the config.json.dist
file in this repository.
You can have an interface to create and validate your config file .
Below is the complete configuration reference:
{
"nickname": "yourbot", // the Twitch name of your bot
"channel": "yourchannel", // the channel the bot must follow
"command_prefix": "!", // the prefix the commands will have (defaults to '!')
"help": true, // if true, a help command will be automatically generated (defaults to true)
"commands": [ // a list of commands that your bot will recognize and respond to (empty by default)
{
"name": "ping", // the command name - spaces are not recommended here (even though they are technically accepted)
"aliases": ["pong"],
"message": "Pong @{author} Kappa" // the message the bot must send when someone invokes this command ('{author}' will be replaced with the user who invoked the command)
}
],
"timer": { // the configuration of the automatically sent messages
"between": {
"time": 10, // the minimum time that must have passed between two messages (defaults to 10)
"messages": 10 // the minimum number of messages that the chat members must have sent between two messages (defaults to 10)
},
"strategy": "round-robin", // the strategy used to send the messages: "round-robin" or "shuffle" (defaults to "round-robin")
// the messages are actually commands with the same options as above
"pool": [ // a list of commands to send (empty by default)
{
"name": "hello",
"aliases": ["hi"],
"message": "Hello World! HeyGuys"
}
]
},
"moderator": {
// The configuration of the moderator (see bellow for more information)
}
}
Twason has features to help you moderate your chat automatically against most of the nuisance that streamers may face to.
Any moderation feature has to be activated in the configuration in the moderator
section of the config.json
file, and have the same options:
{
"moderation-feature": { // replace the name with the moderation feature name
"activate": false, // set this to true to activate the feature
"decision": "delete", // the action to take: "delete" or "timeout"
"duration": 5, // if decision is timeout, the duration of the ban, in seconds
"message": "Calm down, {author}" // this message will be sent in the chat when a member becomes a pain in the ass
}
}
Some moderation features may include more options. In this case, they have to be included in the same way.
The available moderation features are the following:
caps-lock
: moderate the messages written in CAPS LOCK
Additional options:
min-size
: the minimum size of the message to moderatethreshold
: the percentage of capital letters that will trigger the moderationflood
: prevent the members of the chat to flood in your chat
Additional options:
max-word-length
: the maximum length of a wordignore-hashtags
: if true
, don’t moderate the hashtags (defaults to false
)max-msg-occurrences
: the number of times a message can be repeated before it gets moderatedmin-time-between-occurrence
: the time in which a message is counted, in seconds
a member will be moderated if they send max-msg-occurrences
in min-time-between-occurrence
secondsraid-cooldown
: when a raid happens, the time in minutes of cooldown in which the flood is authorized