mirror of https://gitlab.com/gpvkt/twitchtts.git
v1.2.2
This commit is contained in:
parent
d1c502f38b
commit
d07b4a5d1f
13
CHANGELOG.md
13
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.
|
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
|
## [1.2.1] - 2022-08-13
|
||||||
|
|
||||||
### Changed 1.2.1
|
### 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
|
### Fixed 1.2.0
|
||||||
|
|
||||||
* Improved handling of missing config values.
|
* Improved handling of missing config values
|
||||||
|
|
||||||
## [1.1.0] - 2022-08-12
|
## [1.1.0] - 2022-08-12
|
||||||
|
|
||||||
|
|
Binary file not shown.
5
tts.js
5
tts.js
|
@ -34,6 +34,7 @@ document.querySelector("#start").addEventListener("click", () => {
|
||||||
speech.text = "Init complete";
|
speech.text = "Init complete";
|
||||||
window.speechSynthesis.speak(speech);
|
window.speechSynthesis.speak(speech);
|
||||||
$("#start").hide();
|
$("#start").hide();
|
||||||
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector("#pause").addEventListener("click", () => {
|
document.querySelector("#pause").addEventListener("click", () => {
|
||||||
|
@ -54,7 +55,7 @@ function sleep(ms) {
|
||||||
|
|
||||||
reload = true;
|
reload = true;
|
||||||
|
|
||||||
$(document).ready(function() {
|
function init() {
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
if (reload) {
|
if (reload) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -89,4 +90,4 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
};
|
||||||
|
|
20
tts.py
20
tts.py
|
@ -239,29 +239,35 @@ class IRC:
|
||||||
def check_subonly(self, tags):
|
def check_subonly(self, tags):
|
||||||
""" subonly """
|
""" subonly """
|
||||||
|
|
||||||
|
if not conf['IRC_SUBONLY']:
|
||||||
|
return False
|
||||||
|
|
||||||
subscriber = tags['subscriber']
|
subscriber = tags['subscriber']
|
||||||
badges = tags['badges']
|
badges = tags['badges']
|
||||||
user = tags['user']
|
user = tags['user']
|
||||||
|
|
||||||
if subscriber != "0" or 'moderator' in badges or 'broadcaster' in badges:
|
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
|
return False
|
||||||
|
|
||||||
logging.info('TTS is sub-only')
|
logging.debug('TTS is sub-only')
|
||||||
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['SUBONLY'])
|
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['SUBONLY'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def check_modonly(self, tags):
|
def check_modonly(self, tags):
|
||||||
""" modonly """
|
""" modonly """
|
||||||
|
|
||||||
|
if not conf['IRC_MODONLY']:
|
||||||
|
return False
|
||||||
|
|
||||||
badges = tags['badges']
|
badges = tags['badges']
|
||||||
user = tags['user']
|
user = tags['user']
|
||||||
|
|
||||||
if 'moderator' in badges or 'broadcaster' in badges:
|
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
|
return False
|
||||||
|
|
||||||
logging.info('TTS is sub-only')
|
logging.debug('TTS is mod-only')
|
||||||
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['MODONLY'])
|
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['MODONLY'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -281,7 +287,7 @@ class IRC:
|
||||||
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TOO_LONG'])
|
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), conf['MESSAGE']['TOO_LONG'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
logging.info('Check length: Message is ok')
|
logging.debug('Check length: Message is ok')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def check_user_denied(self, user):
|
def check_user_denied(self, user):
|
||||||
|
@ -725,7 +731,7 @@ def load_config():
|
||||||
conf['IRC_SUBONLY'] = cfg.get('bot', {}).get('subonly', False)
|
conf['IRC_SUBONLY'] = cfg.get('bot', {}).get('subonly', False)
|
||||||
conf['IRC_MODONLY'] = cfg.get('bot', {}).get('modonly', False)
|
conf['IRC_MODONLY'] = cfg.get('bot', {}).get('modonly', False)
|
||||||
conf['IRC_TTS_LEN'] = cfg.get('bot', {}).get('message_length', 200)
|
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['LOG_LEVEL'] = cfg.get('log', {}).get('level', "INFO")
|
||||||
conf['HTTP_PORT'] = cfg.get('http', {}).get('port', 80)
|
conf['HTTP_PORT'] = cfg.get('http', {}).get('port', 80)
|
||||||
|
@ -789,7 +795,7 @@ sys.tracebacklimit = 0
|
||||||
if sys.argv[1:]:
|
if sys.argv[1:]:
|
||||||
if sys.argv[1] == "--version":
|
if sys.argv[1] == "--version":
|
||||||
print('Simple TTS Bot')
|
print('Simple TTS Bot')
|
||||||
print('Version 1.2.1')
|
print('Version 1.2.2')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def send_tts_queue():
|
def send_tts_queue():
|
||||||
|
|
Loading…
Reference in New Issue