Send a chatmessage on !ton/!toff

This commit is contained in:
gpkvt 2022-08-12 10:15:15 +02:00
parent 34437a0ccb
commit df9ce03f98
2 changed files with 7 additions and 1 deletions

View File

@ -91,6 +91,8 @@ whitelist:
##### messages ##### messages
* `toff`: The bots reply when `!toff` is used.
* `ton`: The bots reply when `!ton` is used.
* `too_long`: The bots reply if message exceeds `message_length` * `too_long`: The bots reply if message exceeds `message_length`
* `disabled`: The bots reply if TTS is disabled * `disabled`: The bots reply if TTS is disabled
* `denied`: The bots reply if the user is not allowed to use TTS * `denied`: The bots reply if the user is not allowed to use TTS

6
tts.py
View File

@ -192,6 +192,7 @@ class IRC:
msg_queue.clear() msg_queue.clear()
msg_queue_raw.clear() msg_queue_raw.clear()
self.tts_status = False self.tts_status = False
self.sendpriv(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TOFF'])
return True return True
@ -200,6 +201,7 @@ class IRC:
msg_queue.clear() msg_queue.clear()
msg_queue_raw.clear() msg_queue_raw.clear()
self.tts_status = True self.tts_status = True
self.sendpriv(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TON'])
return True return True
@ -379,7 +381,9 @@ def load_config():
conf['HTTP_BIND'] = cfg['http']['bind'] or "localhost" conf['HTTP_BIND'] = cfg['http']['bind'] or "localhost"
conf['MESSAGE'] = {} conf['MESSAGE'] = {}
conf['MESSAGE']['TOO_LONG'] = cfg['messages']['too_long'] or "Sorry, your message is too long" conf['MESSAGE']['TOFF'] = cfg['messages']['toff'] or "TTS is now disabled."
conf['MESSAGE']['TON'] = cfg['messages']['ton'] or "TTS is now active."
conf['MESSAGE']['TOO_LONG'] = cfg['messages']['too_long'] or "Sorry, your message is too long."
conf['MESSAGE']['DISABLED'] = cfg['messages']['disabled'] or "Sorry, TTS is disabled." conf['MESSAGE']['DISABLED'] = cfg['messages']['disabled'] or "Sorry, TTS is disabled."
conf['MESSAGE']['DENIED'] = cfg['messages']['denied'] or "Sorry, you're not allowed to use TTS." conf['MESSAGE']['DENIED'] = cfg['messages']['denied'] or "Sorry, you're not allowed to use TTS."
conf['MESSAGE']['SUBONLY'] = cfg['messages']['subonly'] or "Sorry, TTS is sub-only." conf['MESSAGE']['SUBONLY'] = cfg['messages']['subonly'] or "Sorry, TTS is sub-only."