mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 09:07:34 +01:00 
			
		
		
		
	Added option to disable functions
This commit is contained in:
		
							parent
							
								
									7d2a85173a
								
							
						
					
					
						commit
						df450f9eaf
					
				
					 5 changed files with 61 additions and 20 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.7.0] - 2022-08-27 | ||||||
|  | 
 | ||||||
|  | ### Added 1.7.0 | ||||||
|  | 
 | ||||||
|  | * Option to disable functions in `config.yml` | ||||||
|  | 
 | ||||||
| ## [1.6.1] - 2022-08-25 | ## [1.6.1] - 2022-08-25 | ||||||
| 
 | 
 | ||||||
| ### Fixed 1.6.1 | ### Fixed 1.6.1 | ||||||
|  |  | ||||||
							
								
								
									
										16
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
										
									
									
									
								
							|  | @ -181,6 +181,7 @@ Connect to the configured Twitch channel and send a message starting with `!tts` | ||||||
| Additional commands (broadcaster and mods only) are: | Additional commands (broadcaster and mods only) are: | ||||||
| 
 | 
 | ||||||
| * `!ping`: Check if bot is alive (the bot should reply: `Pong!`) | * `!ping`: Check if bot is alive (the bot should reply: `Pong!`) | ||||||
|  | * `!version`: Print the bot version | ||||||
| * `!toff`: Turn TTS off (will also empty the current TTS queue) | * `!toff`: Turn TTS off (will also empty the current TTS queue) | ||||||
| * `!ton`: Turn TTS back on | * `!ton`: Turn TTS back on | ||||||
| * `!dtts <username>`: Disable TTS for the given user | * `!dtts <username>`: Disable TTS for the given user | ||||||
|  | @ -190,6 +191,21 @@ Additional commands (broadcaster and mods only) are: | ||||||
| 
 | 
 | ||||||
| ### Additional features | ### Additional features | ||||||
| 
 | 
 | ||||||
|  | You can enable/disable any feature in your `config.yml`: | ||||||
|  | 
 | ||||||
|  | ``` lang=yaml | ||||||
|  | features: | ||||||
|  |   quote: False | ||||||
|  |   pick: False | ||||||
|  |   vote: False | ||||||
|  |   wiki: False | ||||||
|  |   random: False | ||||||
|  |   version: True | ||||||
|  |   ping: True | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | The default is enabled. | ||||||
|  | 
 | ||||||
| #### !quickvote | #### !quickvote | ||||||
| 
 | 
 | ||||||
| A simple vote system. | A simple vote system. | ||||||
|  |  | ||||||
|  | @ -16,6 +16,15 @@ bot: | ||||||
|   message_length: 200 # Max. TTS message length |   message_length: 200 # Max. TTS message length | ||||||
|   language: de # Language for wikipedia |   language: de # Language for wikipedia | ||||||
| 
 | 
 | ||||||
|  | features: | ||||||
|  |   quote: True | ||||||
|  |   pick: True | ||||||
|  |   vote: True | ||||||
|  |   wiki: True | ||||||
|  |   random: True | ||||||
|  |   version: True | ||||||
|  |   ping: True | ||||||
|  | 
 | ||||||
| messages: # Things the bot can send as chat message | messages: # Things the bot can send as chat message | ||||||
|   toff: "TTS is now inactive." |   toff: "TTS is now inactive." | ||||||
|   ton: "TTS is now active." |   ton: "TTS is now active." | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										50
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										50
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -179,20 +179,21 @@ class IRC: | ||||||
|             self.Commands.tts(self, message, tags) |             self.Commands.tts(self, message, tags) | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         if msg.startswith('!addquote'): |         if msg.startswith('!wiki') and conf['FEATURE']['WIKI']: | ||||||
|             logging.debug("!addquote command detected") |  | ||||||
|             self.Commands.addquote(self, tags, msg) |  | ||||||
|             return |  | ||||||
| 
 |  | ||||||
|         if msg.startswith('!wiki'): |  | ||||||
|             logging.debug("!wiki command detected") |             logging.debug("!wiki command detected") | ||||||
|             self.Commands.wiki(self, tags, msg) |             self.Commands.wiki(self, tags, msg) | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         if msg.startswith('!smartquote') or msg.startswith('!sq'): |         if conf['FEATURE']['QUOTE']: | ||||||
|             logging.debug("!smartquote command detected") |             if msg.startswith('!addquote'): | ||||||
|             self.Commands.quote(self, tags, msg) |                 logging.debug("!addquote command detected") | ||||||
|             return |                 self.Commands.addquote(self, tags, msg) | ||||||
|  |                 return | ||||||
|  | 
 | ||||||
|  |             if msg.startswith('!smartquote') or msg.startswith('!sq'): | ||||||
|  |                 logging.debug("!smartquote command detected") | ||||||
|  |                 self.Commands.quote(self, tags, msg) | ||||||
|  |                 return | ||||||
| 
 | 
 | ||||||
|     def get_tags(self, resp): |     def get_tags(self, resp): | ||||||
|         """ Strip tags from response """ |         """ Strip tags from response """ | ||||||
|  | @ -236,27 +237,23 @@ class IRC: | ||||||
|         user = tags['user'] |         user = tags['user'] | ||||||
| 
 | 
 | ||||||
|         if 'broadcaster' in badges or 'moderator' in badges: |         if 'broadcaster' in badges or 'moderator' in badges: | ||||||
|             if msg.startswith('!ping'): |             if msg.startswith('!ping') and conf['FEATURE']['PING']: | ||||||
|                 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!") | ||||||
| 
 | 
 | ||||||
|             elif msg.startswith('!version'): |             elif msg.startswith('!version') and conf['FEATURE']['VERSION']: | ||||||
|                 logging.debug("!version command detected") |                 logging.debug("!version command detected") | ||||||
|                 self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), VERSION) |                 self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), VERSION) | ||||||
| 
 | 
 | ||||||
|             elif msg.startswith('!pick'): |             elif msg.startswith('!pick') and conf['FEATURE']['PICK']: | ||||||
|                 logging.debug("!pick command detected") |                 logging.debug("!pick command detected") | ||||||
|                 self.Commands.pick(self, msg) |                 self.Commands.pick(self, msg) | ||||||
| 
 | 
 | ||||||
|             elif msg.startswith('!dtts'): |             elif msg.startswith('!random') and conf['FEATURE']['RANDOM']: | ||||||
|                 logging.debug("!dtts command detected") |  | ||||||
|                 self.Commands.dtts(self, msg) |  | ||||||
| 
 |  | ||||||
|             elif msg.startswith('!random'): |  | ||||||
|                 logging.info('!random command detected') |                 logging.info('!random command detected') | ||||||
|                 self.Commands.random(self, msg) |                 self.Commands.random(self, msg) | ||||||
| 
 | 
 | ||||||
|             elif msg.startswith('!quickvote'): |             elif msg.startswith('!quickvote') and conf['FEATURE']['QUOTE']: | ||||||
|                 logging.info("!quickvote command detected") |                 logging.info("!quickvote command detected") | ||||||
|                 self.Commands.quickvote(self, msg) |                 self.Commands.quickvote(self, msg) | ||||||
| 
 | 
 | ||||||
|  | @ -264,6 +261,10 @@ class IRC: | ||||||
|                 logging.debug("!ptts command detected") |                 logging.debug("!ptts command detected") | ||||||
|                 self.Commands.ptts(self, msg) |                 self.Commands.ptts(self, msg) | ||||||
| 
 | 
 | ||||||
|  |             elif msg.startswith('!dtts'): | ||||||
|  |                 logging.debug("!dtts command detected") | ||||||
|  |                 self.Commands.dtts(self, msg) | ||||||
|  | 
 | ||||||
|             elif msg.startswith('!usermap'): |             elif msg.startswith('!usermap'): | ||||||
|                 logging.info('!usermap command detected') |                 logging.info('!usermap command detected') | ||||||
|                 self.Commands.usermap(self, msg) |                 self.Commands.usermap(self, msg) | ||||||
|  | @ -1159,6 +1160,15 @@ def load_config(): | ||||||
|             conf['MESSAGE']['WIKI_TOO_MANY'] = cfg.get('messages', {}).get('wiki_too_many', "Sorry, there are too many possible results. Try a more narrow search.") |             conf['MESSAGE']['WIKI_TOO_MANY'] = cfg.get('messages', {}).get('wiki_too_many', "Sorry, there are too many possible results. Try a more narrow search.") | ||||||
|             conf['MESSAGE']['WIKI_NO_RESULT'] = cfg.get('messages', {}).get('wiki_no_result', "Sorry, there was an error fetching the wikipedia answer.") |             conf['MESSAGE']['WIKI_NO_RESULT'] = cfg.get('messages', {}).get('wiki_no_result', "Sorry, there was an error fetching the wikipedia answer.") | ||||||
| 
 | 
 | ||||||
|  |             conf['FEATURE'] = {} | ||||||
|  |             conf['FEATURE']['WIKI'] = cfg.get('features', {}).get('wiki', True) | ||||||
|  |             conf['FEATURE']['PICK'] = cfg.get('features', {}).get('pick', True) | ||||||
|  |             conf['FEATURE']['VOTE'] = cfg.get('features', {}).get('vote', True) | ||||||
|  |             conf['FEATURE']['QUOTE'] = cfg.get('features', {}).get('quote', True) | ||||||
|  |             conf['FEATURE']['RANDOM'] = cfg.get('features', {}).get('random', True) | ||||||
|  |             conf['FEATURE']['VERSION'] = cfg.get('features', {}).get('version', True) | ||||||
|  |             conf['FEATURE']['PING'] = cfg.get('features', {}).get('ping', True) | ||||||
|  | 
 | ||||||
|             conf['USERMAP'] = cfg.get('usermapping', []) |             conf['USERMAP'] = cfg.get('usermapping', []) | ||||||
| 
 | 
 | ||||||
|             if 'whitelist' in cfg: |             if 'whitelist' in cfg: | ||||||
|  | @ -1302,7 +1312,7 @@ if __name__ == "__main__": | ||||||
|     logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(module)s %(threadName)s %(levelname)s: %(message)s') |     logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(module)s %(threadName)s %(levelname)s: %(message)s') | ||||||
|     sys.tracebacklimit = 3 |     sys.tracebacklimit = 3 | ||||||
| 
 | 
 | ||||||
|     VERSION = "1.6.1" |     VERSION = "1.7.0" | ||||||
|     conf = {} |     conf = {} | ||||||
|     tts_done = [] |     tts_done = [] | ||||||
|     msg_queue_raw = [] |     msg_queue_raw = [] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue