diff --git a/CHANGELOG.md b/CHANGELOG.md index dee22fb..9db44f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. If there is a `Changed` section please read carefully, as this often means that you will need to adapt your `config.yml`, otherwise the bot might fail to start. +## [1.2.2] - 2022-08-13 + +### Changed 1.2.2 + +* The message queue is only queried when the Init button is pressed +* Further code optimization + +### Fixed 1.2.2 + +* Minor fixes + ## [1.2.1] - 2022-08-13 ### Changed 1.2.1 @@ -25,7 +36,7 @@ All notable changes to this project will be documented in this file. If there is ### Fixed 1.2.0 -* Improved handling of missing config values. +* Improved handling of missing config values ## [1.1.0] - 2022-08-12 diff --git a/dist/tts.exe b/dist/tts.exe index dfb3b27..f5e75f4 100644 Binary files a/dist/tts.exe and b/dist/tts.exe differ diff --git a/tts.js b/tts.js index d9a7fce..92dbb22 100644 --- a/tts.js +++ b/tts.js @@ -34,6 +34,7 @@ document.querySelector("#start").addEventListener("click", () => { speech.text = "Init complete"; window.speechSynthesis.speak(speech); $("#start").hide(); + init(); }); document.querySelector("#pause").addEventListener("click", () => { @@ -54,7 +55,7 @@ function sleep(ms) { reload = true; -$(document).ready(function() { +function init() { setInterval(function(){ if (reload) { $.ajax({ @@ -89,4 +90,4 @@ $(document).ready(function() { }); } }, 1000); -}); +}; diff --git a/tts.py b/tts.py index fc4ea70..bef7f15 100644 --- a/tts.py +++ b/tts.py @@ -239,29 +239,35 @@ class IRC: def check_subonly(self, tags): """ subonly """ + if not conf['IRC_SUBONLY']: + return False + subscriber = tags['subscriber'] badges = tags['badges'] user = tags['user'] if subscriber != "0" or 'moderator' in badges or 'broadcaster' in badges: - logging.debug('TTS is sub-only and user has allowance') + logging.info('TTS is sub-only and user has allowance') return False - logging.info('TTS is sub-only') + logging.debug('TTS is sub-only') self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['SUBONLY']) return True def check_modonly(self, tags): """ modonly """ + if not conf['IRC_MODONLY']: + return False + badges = tags['badges'] user = tags['user'] if 'moderator' in badges or 'broadcaster' in badges: - logging.debug('TTS is mod-only and user has allowance') + logging.info('TTS is mod-only and user has allowance') return False - logging.info('TTS is sub-only') + logging.debug('TTS is mod-only') self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['MODONLY']) return True @@ -281,7 +287,7 @@ class IRC: self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TOO_LONG']) return True - logging.info('Check length: Message is ok') + logging.debug('Check length: Message is ok') return False def check_user_denied(self, user): @@ -725,7 +731,7 @@ def load_config(): conf['IRC_SUBONLY'] = cfg.get('bot', {}).get('subonly', False) conf['IRC_MODONLY'] = cfg.get('bot', {}).get('modonly', False) conf['IRC_TTS_LEN'] = cfg.get('bot', {}).get('message_length', 200) - conf['TTS_STARTENABLED'] = cfg.get('bot', {}).get('start_enabled', False) + conf['TTS_STARTENABLED'] = cfg.get('bot', {}).get('start_enabled', True) conf['LOG_LEVEL'] = cfg.get('log', {}).get('level', "INFO") conf['HTTP_PORT'] = cfg.get('http', {}).get('port', 80) @@ -789,7 +795,7 @@ sys.tracebacklimit = 0 if sys.argv[1:]: if sys.argv[1] == "--version": print('Simple TTS Bot') - print('Version 1.2.1') + print('Version 1.2.2') sys.exit(1) def send_tts_queue():