mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 17:17:35 +01:00 
			
		
		
		
	Ease rules on commands
This commit is contained in:
		
							parent
							
								
									e9a2c0bd61
								
							
						
					
					
						commit
						4fd1b0941d
					
				
					 4 changed files with 21 additions and 13 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.3.2] - 2022-08-20 | ||||||
|  | 
 | ||||||
|  | ### Fixed 1.3.2 | ||||||
|  | 
 | ||||||
|  | * `!smartquote` and `!addquote` are not longer Mods only. | ||||||
|  | 
 | ||||||
| ## [1.3.1] - 2022-08-19 | ## [1.3.1] - 2022-08-19 | ||||||
| 
 | 
 | ||||||
| ### Added 1.3.1 | ### Added 1.3.1 | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										26
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										26
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -166,6 +166,14 @@ class IRC: | ||||||
|             logging.info('!tts command detected') |             logging.info('!tts command detected') | ||||||
|             self.Commands.tts(self, message, tags) |             self.Commands.tts(self, message, tags) | ||||||
| 
 | 
 | ||||||
|  |         if msg.startswith('!addquote'): | ||||||
|  |             logging.debug("!addquote command detected") | ||||||
|  |             self.Commands.addquote(self, tags, msg) | ||||||
|  | 
 | ||||||
|  |         if msg.startswith('!smartquote'): | ||||||
|  |             logging.debug("!smartquote command detected") | ||||||
|  |             self.Commands.quote(self, tags, msg) | ||||||
|  | 
 | ||||||
|     def get_tags(self, resp): |     def get_tags(self, resp): | ||||||
|         """ Strip tags from response """ |         """ Strip tags from response """ | ||||||
| 
 | 
 | ||||||
|  | @ -212,14 +220,6 @@ class IRC: | ||||||
|                 logging.debug("Ping check received.") |                 logging.debug("Ping check received.") | ||||||
|                 self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), "Pong!") |                 self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), "Pong!") | ||||||
| 
 | 
 | ||||||
|             if msg.startswith('!addquote'): |  | ||||||
|                 logging.debug("!addquote command detected") |  | ||||||
|                 self.Commands.addquote(self, tags, msg) |  | ||||||
| 
 |  | ||||||
|             if msg.startswith('!smartquote'): |  | ||||||
|                 logging.debug("!smartquote command detected") |  | ||||||
|                 self.Commands.quote(self, tags, msg) |  | ||||||
| 
 |  | ||||||
|             elif msg.startswith('!dtts'): |             elif msg.startswith('!dtts'): | ||||||
|                 logging.debug("!dtts command detected") |                 logging.debug("!dtts command detected") | ||||||
|                 self.Commands.dtts(self, msg) |                 self.Commands.dtts(self, msg) | ||||||
|  | @ -528,7 +528,7 @@ class IRC: | ||||||
| 
 | 
 | ||||||
|                     file = open("quotes.txt", "rb") |                     file = open("quotes.txt", "rb") | ||||||
|                     quotes = file.readlines() |                     quotes = file.readlines() | ||||||
|                     matches = process.extract(query, quotes, limit=20) |                     matches = process.extract(query, quotes, limit=10) | ||||||
|                     quotes = [] |                     quotes = [] | ||||||
| 
 | 
 | ||||||
|                     for match, score in matches: |                     for match, score in matches: | ||||||
|  | @ -536,8 +536,10 @@ class IRC: | ||||||
|                             quotes.append(match) |                             quotes.append(match) | ||||||
| 
 | 
 | ||||||
|                     logging.debug('Quotes: %s', quotes) |                     logging.debug('Quotes: %s', quotes) | ||||||
|                     if len(quotes) >= 1: |                     if len(quotes) >= 5: | ||||||
|                         quote = random.choice(quotes) |                         quote = random.choice(quotes) | ||||||
|  |                     else: | ||||||
|  |                         quote = quotes[0] | ||||||
| 
 | 
 | ||||||
|                 else: |                 else: | ||||||
|                     logging.info('Fetching random quote') |                     logging.info('Fetching random quote') | ||||||
|  | @ -831,7 +833,7 @@ class HTTPserv(BaseHTTPRequestHandler): | ||||||
|             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()]) |                         logging.debug('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]) |                         logging.debug('No usermap entry found for user: %s', msg_queue[key][0]) | ||||||
|  | @ -1106,7 +1108,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.3.1') |             print('Version 1.3.2') | ||||||
|             sys.exit(1) |             sys.exit(1) | ||||||
| 
 | 
 | ||||||
|     main() |     main() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue