Improved README

This commit is contained in:
gpkvt 2022-08-11 13:20:56 +02:00
parent 0d06abab5b
commit ec14e4a51e
1 changed files with 56 additions and 11 deletions

View File

@ -2,13 +2,33 @@
A simple Twitch TTS bot
## Installation
## Description
The goal of this project is to provide a simple to use Text to Speech IRC bot. It's mainly focused on Twitch, but might be easily adapt to other IRC chats as well. Anyway, right now some parts are Twitch specific (like `CAP REQ :twitch.tv/commands twitch.tv/tags`). There are some other projects providing TTS for IRC based chats, like [IRC Radio (TTS)](https://play.google.com/store/apps/details?id=com.earthflare.android.ircradio&hl=en&gl=US), but they are missing moderation features like Black-/Whitelists or deletion of single messages, before they are read. Therefore I created my own TTS bot, providing those features.
The project consits of a very simple IRC client, which monitors the incoming messages. If a valid`!tts` command is detected the message will send into a queue. Depending on your config it will wait there a few seconds for deletion by you/your moderators. If nobody deletes the message, it will send into another queue. This queue will get fetched by the HTML frontend, which will be delivered by an internal webserver (backend). The HTML frontend will use the [Web Speech API](https://wicg.github.io/speech-api/) included in any modern webbrowser to read the incoming TTS message. When this is done it will report back to the webserver and the message will be removed from the queue.
The server part is written in Python. The TTS part is written in Javascript.
By using Javascript for the actual TTS part it's not only very easy to access the Web Speech API and the underlying Speech features of your OS, it also makes it possible to use a wide range of devices to actually play the TTS output. You can start the backend on your PC/Server and open the frontend on your Android/iOS tablet or Mobile Phone. If you expose the backend to the internet (I would recommend to use a reverse proxy, rather than exposing the backend directly) you can also use the TTS bot on the go (e.g. your IRL setup).
(⃰sender is not on the blacklist, message is not too long, etc.)
## Getting Started
### Dependencies
* Browser with Web Speech API support
* Web Speech API Voices
* If you use `tts.py` see `requirements.txt`. If you use `tts.exe` all dependencies are included.
### Installing
1. Clone the repo, or download and unzip the newest [Release](https://gitlab.com/gpvkt/twitchtts/-/releases)
2. Rename/copy `config-dist.yml` to `config.yml`
3. (Optional) Move/copy `./dist/tts.exe` into the main directory (you can omit this step if you have Python installed)
## Configuration
### Configuration
Adapt `config.yml` to your needs. Example:
@ -50,7 +70,7 @@ whitelist:
**Explanation**:
### irc
#### irc
* `channel`: Channel you want to monitor (e.g. #gpkvt)
* `username`: The bots username (e.g. gpkvt)
@ -58,18 +78,18 @@ whitelist:
* `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
### http
#### http
* `port`: Internal Webserver Port to listen to (e.g. 8080)
* `bind`: Interface/IP to bind server to (e.g. localhost)
### bot
#### bot
* `subonly`: If `True` only Subs can use TTS
* `modonly`: If `True` only Mods can use TTS
* `message_length`: Maximum allowed message length for TTS
### messages
#### messages
* `too_long`: The bots reply if message exceeds `message_length`
* `disabled`: The bots reply if TTS is disabled
@ -79,15 +99,15 @@ whitelist:
* `ready`: The bots init message
* `says`: Prefix to add between username and message
### log
#### log
* `level`: The loglevel, valid values are: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
### usermapping
#### usermapping
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).
### whitelist
#### 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.
@ -102,7 +122,7 @@ whitelist:
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`.
## Usage
### Executing program
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 bottom of the TTS webpage (you should hear `Init complete`).
@ -122,6 +142,31 @@ The voices available depends on your Operating System and/or browser. On some sy
On Windows you can install additional voices via `Settings` > `Time & language` > `Speech` > `Add voices` or by simply run `Add speech voices`
# Troubleshooting
## Help
Feel free to use the [Issuetracker](https://gitlab.com/gpvkt/twitchtts/-/issues) if you experience any problems.
## Authors
[@gpkvt](https://gitlab.com/gpvkt)
## Version History
There is no stable release, yet.
## 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/)