mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 17:17:35 +01:00 
			
		
		
		
	Improved logging
This commit is contained in:
		
							parent
							
								
									995738368c
								
							
						
					
					
						commit
						4097b6f615
					
				
					 3 changed files with 14 additions and 4 deletions
				
			
		|  | @ -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 | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								dist/tts.exe
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								dist/tts.exe
									
										
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										12
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -61,6 +61,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: | ||||||
|  | @ -640,12 +641,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) | ||||||
|  | @ -776,8 +780,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.') | ||||||
|  | @ -843,7 +846,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(): | ||||||
|  | @ -872,6 +875,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) | ||||||
|  | @ -914,7 +918,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…
	
	Add table
		
		Reference in a new issue