Go to file
gpkvt ec437cacad Updated tts.exe 2022-08-11 00:44:38 +02:00
dist Updated tts.exe 2022-08-11 00:44:38 +02:00
.gitignore Add files 2022-08-10 20:58:51 +02:00
CONTRIBUTING.md Add files 2022-08-10 20:58:51 +02:00
LICENSE Add files 2022-08-10 20:58:51 +02:00
README.md Add files 2022-08-10 20:58:51 +02:00
bootstrap.min.css Add files 2022-08-10 20:58:51 +02:00
config-dist.yml Bugfix: Add config options, disabled webserver logging 2022-08-11 00:09:06 +02:00
jquery.js Add files 2022-08-10 20:58:51 +02:00
requirements.txt Add requirements.txt 2022-08-10 21:55:28 +02:00
tts.html Add files 2022-08-10 20:58:51 +02:00
tts.js Add files 2022-08-10 20:58:51 +02:00
tts.py Bugfix: Check if user is on allowed list before removing him 2022-08-11 00:43:09 +02:00

README.md

Twitch TextToSpeech Bot

A simple Twitch TTS bot

Installation

Clone the repo, move/copy ./dist/tts.exe into the main directory. Rename config-dist.yml to config.yml

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:

irc

  • 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

http

  • port: Internal Webserver Port to listen to (e.g. 8080)
  • bind: Interface/IP to bind server to (e.g. localhost)

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

  • 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

log

  • level: The loglevel, valid values are: DEBUG, INFO, WARNING, ERROR, CRITICAL

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

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

To disable the whitelist remove it from config.yml completely. If you just leave whitelist: without entries, everyone must be whitelisted using !ptts. The permit is temporarily until the bot restarts or the user is removed from the (temporary) whitelist using !dtts.

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