This commit is contained in:
gpkvt 2022-08-13 20:43:00 +02:00
parent d1c502f38b
commit d07b4a5d1f
4 changed files with 28 additions and 10 deletions

View File

@ -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

BIN
dist/tts.exe vendored

Binary file not shown.

5
tts.js
View File

@ -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);
});
};

20
tts.py
View File

@ -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():