mirror of https://gitlab.com/gpvkt/twitchtts.git
Merge branch 'main' of gitlab.com:gpvkt/twitchtts
This commit is contained in:
commit
1f5262fb2b
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
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.5] - 2022-08.16
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* Improved logging
|
||||||
|
|
||||||
## [1.2.4] - 2022-08-15
|
## [1.2.4] - 2022-08-15
|
||||||
|
|
||||||
### Added 1.2.4
|
### Added 1.2.4
|
||||||
|
|
Binary file not shown.
12
tts.py
12
tts.py
|
@ -63,6 +63,7 @@ class IRC:
|
||||||
def connect(self, server, port, channel, botnick, botpass):
|
def connect(self, server, port, channel, botnick, botpass):
|
||||||
""" Connect to Twitch IRC servers """
|
""" Connect to Twitch IRC servers """
|
||||||
logging.info("Connecting to: %s", server)
|
logging.info("Connecting to: %s", server)
|
||||||
|
logging.info('Waiting...')
|
||||||
try:
|
try:
|
||||||
self.irc.connect((server, port))
|
self.irc.connect((server, port))
|
||||||
except ConnectionResetError:
|
except ConnectionResetError:
|
||||||
|
@ -790,12 +791,15 @@ class HTTPserv(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
usermap = conf['USERMAP']
|
usermap = conf['USERMAP']
|
||||||
sorted_tts = {k: msg_queue[k] for k in sorted(msg_queue, reverse=True)}
|
sorted_tts = {k: msg_queue[k] for k in sorted(msg_queue, reverse=True)}
|
||||||
|
logging.debug(usermap)
|
||||||
|
|
||||||
for key in list(sorted_tts.keys()):
|
for key in list(sorted_tts.keys()):
|
||||||
if key not in tts_done:
|
if key not in tts_done:
|
||||||
if msg_queue[key][0].lower() in usermap:
|
if msg_queue[key][0].lower() in usermap:
|
||||||
|
logging.info('Using usermap for user: %s (%s)', msg_queue[key][0], usermap[msg_queue[key][0].lower()])
|
||||||
tts = {str(key): str(usermap[msg_queue[key][0].lower()]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
|
tts = {str(key): str(usermap[msg_queue[key][0].lower()]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
|
||||||
else:
|
else:
|
||||||
|
logging.debug('No usermap entry found for user: %s', msg_queue[key][0])
|
||||||
tts = {str(key): str(msg_queue[key][0]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
|
tts = {str(key): str(msg_queue[key][0]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
|
||||||
|
|
||||||
tts_json = json.dumps(tts)
|
tts_json = json.dumps(tts)
|
||||||
|
@ -930,8 +934,7 @@ def load_config():
|
||||||
|
|
||||||
if conf['WHITELIST']:
|
if conf['WHITELIST']:
|
||||||
logging.info('Whitelist mode enabled')
|
logging.info('Whitelist mode enabled')
|
||||||
logging.debug('Whitelist:')
|
logging.debug('Whitelist: %s', conf['WHITELIST_USER'])
|
||||||
logging.debug(conf['WHITELIST_USER'])
|
|
||||||
|
|
||||||
if not conf['IRC_CHANNEL']:
|
if not conf['IRC_CHANNEL']:
|
||||||
raise ValueError('Please add your twitch channel to config.yml.')
|
raise ValueError('Please add your twitch channel to config.yml.')
|
||||||
|
@ -997,7 +1000,7 @@ def check_oauth_token():
|
||||||
conf = load_config()
|
conf = load_config()
|
||||||
check_oauth_token()
|
check_oauth_token()
|
||||||
|
|
||||||
logging.info('OAuth Token is valid.')
|
logging.info('OAuth Token is valid')
|
||||||
return conf
|
return conf
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -1026,6 +1029,7 @@ def main():
|
||||||
irc.connect(conf['IRC_SERVER'], 6667, conf['IRC_CHANNEL'], conf['IRC_USERNAME'], conf['IRC_OAUTH_TOKEN'])
|
irc.connect(conf['IRC_SERVER'], 6667, conf['IRC_CHANNEL'], conf['IRC_USERNAME'], conf['IRC_OAUTH_TOKEN'])
|
||||||
irc.sendmsg(conf['IRC_CHANNEL'], 'MrDestructoid', conf['MESSAGE']['READY'])
|
irc.sendmsg(conf['IRC_CHANNEL'], 'MrDestructoid', conf['MESSAGE']['READY'])
|
||||||
|
|
||||||
|
logging.info('Connected and joined')
|
||||||
url = get_url()
|
url = get_url()
|
||||||
logging.info("Please open your browser and visit: %s", url)
|
logging.info("Please open your browser and visit: %s", url)
|
||||||
webbrowser.open_new_tab(url)
|
webbrowser.open_new_tab(url)
|
||||||
|
@ -1068,7 +1072,7 @@ if __name__ == "__main__":
|
||||||
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.4')
|
print('Version 1.2.5')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue