Added option to start in TTS disabled state

This commit is contained in:
gpkvt 2022-08-12 12:40:00 +02:00
parent a65a2dcccb
commit 7da1e01cd6
3 changed files with 11 additions and 2 deletions

View file

@ -45,6 +45,7 @@ http:
bind: "localhost"
bot:
start_enabled: True
subonly: False
modonly: False
message_length: 200
@ -88,7 +89,8 @@ whitelist:
* `bind`: Interface/IP to bind server to (e.g. localhost)
##### bot
* `start_enabled`: Enable the bot on start? If `False` you need to use `!ton` first to make TTS work.
* `subonly`: If `True` only Subs can use TTS
* `modonly`: If `True` only Mods can use TTS
* `message_length`: Maximum allowed message length for TTS
@ -113,6 +115,8 @@ whitelist:
* `level`: The loglevel, valid values are: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
Do not use `DEBUG` in a production environment.
##### 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).

View file

@ -10,6 +10,7 @@ http:
bind: "localhost"
bot:
start_enabled: True
subonly: False
modonly: False
message_length: 200

6
tts.py
View file

@ -40,7 +40,7 @@ class IRC:
self.irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.tts_denied = []
self.tts_allowed = []
self.tts_status = True
self.tts_status = conf['TTS_STARTENABLED']
self.quickvote = False
self.votemsg = False
self.poll = {}
@ -267,6 +267,9 @@ class IRC:
self.sendpriv(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TOO_LONG'])
return False
logging.debug("tts status: "+str(self.tts_status))
logging.debug(conf['TTS_STARTENABLED'])
if not self.tts_status:
logging.info('TTS is disabled')
self.sendpriv(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['DISABLED'])
@ -429,6 +432,7 @@ def load_config():
conf['IRC_SUBONLY'] = cfg['bot']['subonly'] or False
conf['IRC_MODONLY'] = cfg['bot']['modonly'] or False
conf['IRC_TTS_LEN'] = cfg['bot']['message_length'] or 200
conf['TTS_STARTENABLED'] = cfg['bot']['start_enabled'] or False
conf['LOG_LEVEL'] = cfg['log']['level'] or "INFO"
conf['HTTP_PORT'] = cfg['http']['port'] or 80