twitchtts/README.md

156 lines
5.5 KiB
Markdown
Raw Normal View History

2022-08-10 20:58:51 +02:00
# Twitch TextToSpeech Bot
2022-08-11 13:24:52 +02:00
A simple Twitch TTS bot (Web Speech API)
2022-08-10 20:58:51 +02:00
## Installation
2022-08-11 23:06:56 +02:00
Clone the repo (or fetch the [latest Release](https://gitlab.com/gpvkt/twitchtts/-/releases)), move/copy `./dist/tts.exe` into the main directory. Rename `config-dist.yml` to `config.yml`
2022-08-10 20:58:51 +02:00
## Configuration
Adapt `config.yml` to your needs. Example:
```
irc:
channel: "#gpkvt"
username: "ttsbot"
oauth_token: "oauth:ohkoace0wooghue8she9xaN0nooSau"
server: "irc.chat.twitch.tv"
clearmsg_timeout: 10
http:
port: 80
bind: "localhost"
bot:
subonly: False
modonly: False
message_length: 200
messages:
too_long: "Sorry, your TTS message is too long."
disabled: "Sorry, TTS is disabled right now."
denied: "Sorry, you are not allowed to use TTS."
subonly: "Sorry, TTS is a sub-only feature."
whitelist: "Sorry, you are not allowed to use TTS."
ready: "TTS bot alpha ready!"
says: "says"
log:
level: "INFO"
usermapping:
gpkvt: "gpk"
whitelist:
```
**Explanation**:
2022-08-11 13:20:56 +02:00
#### irc
2022-08-10 20:58:51 +02:00
* `channel`: Channel you want to monitor (e.g. #gpkvt)
* `username`: The bots username (e.g. gpkvt)
* `oauth_token`: The bots OAUTH-Token (e.g. oauth:ohkoace0wooghue8she9xaN0nooSau)
* `server`: Twitch IRC server to be used (default should be fine)
* `clearmsg_timeout`: Time to wait for an moderator to delete a message, before it's added to the TTS queue
2022-08-11 13:20:56 +02:00
#### http
2022-08-10 20:58:51 +02:00
* `port`: Internal Webserver Port to listen to (e.g. 8080)
* `bind`: Interface/IP to bind server to (e.g. localhost)
2022-08-11 13:20:56 +02:00
#### bot
2022-08-10 20:58:51 +02:00
* `subonly`: If `True` only Subs can use TTS
* `modonly`: If `True` only Mods can use TTS
* `message_length`: Maximum allowed message length for TTS
2022-08-11 13:20:56 +02:00
#### messages
2022-08-10 20:58:51 +02:00
* `too_long`: The bots reply if message exceeds `message_length`
* `disabled`: The bots reply if TTS is disabled
* `denied`: The bots reply if the user is not allowed to use TTS
* `subonly`: The bots reply if `subonly` is active and the user isn't one.
* `whitelist`: The bots reply if `whitelist` is set and user isn't on the list.
* `ready`: The bots init message
* `says`: Prefix to add between username and message
2022-08-11 13:20:56 +02:00
#### log
2022-08-10 20:58:51 +02:00
* `level`: The loglevel, valid values are: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
2022-08-11 13:20:56 +02:00
#### usermapping
2022-08-10 20:58:51 +02:00
Use this section to define key:value pairs of usernames. The first value is the Twitch username, the second value is how the bot should pronouce the user, when reading the message. This is helpfull if you have regulars with numbers or strangs chars in the name. You can add new/change entries on the fly without restarting the bot (changes took up to 60 seconds).
2022-08-11 20:04:01 +02:00
Please note: The key (real username) MUST be lowercase.
2022-08-10 20:58:51 +02:00
### whitelist
You can add a whitelist section to `config.yml`, a whitelist will override any other settings like `subonly` and `modonly`. Only users on the whitelist are allowed to use `!tts`. Broadcasters and mods can temporarily add users (including themselfs) to the whitelist by using the `!ptts` command, though.
A whitelist looks as follows:
```
whitelist:
- gpkvt
- foo
- bar
```
2022-08-11 12:14:13 +02:00
To disable the whitelist, remove it from `config.yml` completely. If you just leave `whitelist:` without entries, everyone must be whitelisted using `!ptts` (even broadcaster and mods). The permit is temporary until the bot restarts or (whichever happens first) if the user is removed from the whitelist using `!dtts`.
2022-08-10 20:58:51 +02:00
2022-08-11 20:04:01 +02:00
Please note: Usernames MUST be lowercase.
2022-08-10 20:58:51 +02:00
## Usage
Execute `tts.exe` (or `tts.py` if you have Python installed), open the TTS webpage in your browser (the URL depends on your `bind` and `port` configuration, usually it's just http://localhost). Click the `Init` button at the button of the TTS webpage (you should hear `Init complete`).
Connect to the configured Twitch channel and send a message starting with `!tts`. After a few seconds (depending on your `clearmsg_timeout` config), the message should be read.
Additional commands (broadcaster and mods only) are:
* `!toff`: Turn TTS off (will also empty the current TTS queue)
* `!ton`: Turn TTS back on
* `!dtts <username>`: Disable TTS for the given user
* `!ptts <username>`: Allow TTS for the given user
2022-08-11 12:14:13 +02:00
# Voices
The voices available depends on your Operating System and/or browser. On some systems only a default voice is available and the `Select voice` dropdown might stay empty or will only show entries after you clicked the `Init` button. Some Android devices will show a huge list of voices, but sounds the same no matter which one you choose.
On Windows you can install additional voices via `Settings` > `Time & language` > `Speech` > `Add voices` or by simply run `Add speech voices`
2022-08-11 13:20:56 +02:00
## Help
2022-08-11 12:14:13 +02:00
Feel free to use the [Issuetracker](https://gitlab.com/gpvkt/twitchtts/-/issues) if you experience any problems.
2022-08-11 13:20:56 +02:00
## Authors
[@gpkvt](https://gitlab.com/gpvkt)
## Version History
2022-08-11 20:42:12 +02:00
This is the first release.
2022-08-11 13:20:56 +02:00
## License
This project is licensed under the GPLv3 License - see the LICENSE.md file for details
## Acknowledgments
* [Python Software Foundation and contributors](https://www.python.org/)
* [PyYAML](https://pyyaml.org/)
* [pyinstaller](https://pyinstaller.org/)
* [OpenJS Foundation and jQuery contributors](https://jquery.org/)
* [Twitter Inc. and Bootstrap contributors](https://getbootstrap.com/)
* [GERBrowny and community](https://twitch.tv/gerbrowny/)
* [DerZugger and community](https://www.twitch.tv/derzugger/)
* [Timmeh74 and community](https://www.twitch.tv/timmeh74/)
2022-08-11 13:32:23 +02:00
## Disclaimer
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Twitch Interactive, Inc.