mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 00:57:35 +01:00 
			
		
		
		
	Added !wtoff/!wton commands
This commit is contained in:
		
							parent
							
								
									83811df8c1
								
							
						
					
					
						commit
						d962bd2570
					
				
					 5 changed files with 49 additions and 2 deletions
				
			
		|  | @ -2,12 +2,14 @@ | |||
| 
 | ||||
| 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`. | ||||
| 
 | ||||
| ## [1.8.0] | ||||
| ## [1.8.0] - 2022-10-23 | ||||
| 
 | ||||
| ### Added 1.8.0 | ||||
| 
 | ||||
| * Option to disable TTS audio output for !wiki function | ||||
| * Option to configure the number of sentences fetched by !wiki function | ||||
| * !wikitoff command | ||||
| * !wikiton command | ||||
| 
 | ||||
| ### Changed 1.8.0 | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										16
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
										
									
									
									
								
							|  | @ -69,6 +69,8 @@ features: | |||
| messages: | ||||
|   toff: "TTS is now inactive." | ||||
|   ton: "TTS is now active." | ||||
|   wikitoff: "Wiki TTS is now inactive." | ||||
|   wikiton: "Wiki TTS is now active." | ||||
|   too_long: "Sorry, your TTS message is too long." | ||||
|   disabled: "Sorry, TTS is disabled right now." | ||||
|   denied: "Sorry, you are not allowed to use TTS." | ||||
|  | @ -138,10 +140,22 @@ Please note that the `oauth_token` is valid for approximately 60 days. If it bec | |||
| * `version`: Enable/Disable `!version` function | ||||
| * `ping`: Enable/Disable `!ping` function | ||||
| 
 | ||||
| Please note, the text output from `!wiki` might been shorter that the TTS output. This is due to the Twitch chat message length restriction. Therefore the `wikisentences` option might not have any effects, when `wikitts` is set to `False`. | ||||
| 
 | ||||
| Please also note that every `.` in the wikipedia result is counted as a sentence. This might cause issues with certain date-formats, e.g. if `wikisentences` is set to `1` and `bot:language` is set to `de` the command `!wiki douglas adams` will only return: | ||||
| 
 | ||||
|  ```text | ||||
|  Douglas Noël Adams (* 11. | ||||
|  ``` | ||||
| 
 | ||||
|  Therefore the recommended minimum value for `wikisentences` is `3`. | ||||
| 
 | ||||
| ##### messages | ||||
| 
 | ||||
| * `toff`: The bots reply when `!toff` is used. | ||||
| * `ton`: The bots reply when `!ton` is used. | ||||
| * `wikitoff`: The bots reply when `!wikitoff` is used. | ||||
| * `wikiton`: The bots reply when `!wikiton` is used. | ||||
| * `too_long`: The bots reply if message exceeds `message_length` | ||||
| * `disabled`: The bots reply if TTS is disabled | ||||
| * `denied`: The bots reply if the user is not allowed to use TTS | ||||
|  | @ -206,6 +220,8 @@ Additional commands (broadcaster and mods only) are: | |||
| * `!version`: Print the bot version | ||||
| * `!toff`: Turn TTS off (will also empty the current TTS queue) | ||||
| * `!ton`: Turn TTS back on | ||||
| * `!wton`: Turn on TTS for `!wiki` | ||||
| * `!wtoff`: Turn off TTS for `!wiki` | ||||
| * `!dtts <username>`: Disable TTS for the given user | ||||
| * `!ptts <username>`: Allow TTS for the given user | ||||
| * `!usermap <username> <spoken name>`: Add an entry to the usermapping in `config.yml` | ||||
|  |  | |||
|  | @ -30,6 +30,8 @@ features: | |||
| messages: # Things the bot can send as chat message | ||||
|   toff: "TTS is now inactive." | ||||
|   ton: "TTS is now active." | ||||
|   wikitoff: "TTS is now inactive." | ||||
|   wikiton: "TTS is now active." | ||||
|   too_long: "Sorry, your TTS message is too long." | ||||
|   disabled: "Sorry, TTS is disabled right now." | ||||
|   denied: "Sorry, you are not allowed to use TTS." | ||||
|  |  | |||
							
								
								
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tts.exe
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										29
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										29
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -56,6 +56,9 @@ class IRC: | |||
|             "whitelist": [], | ||||
|             "blacklist": [] | ||||
|         } | ||||
|         self.wikitts = { | ||||
|             "status": CONF['FEATURE']['WIKITTS'] | ||||
|         } | ||||
|         self.quickvote = { | ||||
|             "status": False, | ||||
|             "message": False, | ||||
|  | @ -324,6 +327,24 @@ class IRC: | |||
|                     CONF['MESSAGE']['TON'] | ||||
|                 ) | ||||
| 
 | ||||
|             elif msg.startswith('!wton'): | ||||
|                 logging.info('Wiki TTS is now turned on') | ||||
|                 self.wikitts['status'] = True | ||||
|                 self.sendmsg( | ||||
|                     CONF['IRC_CHANNEL'], | ||||
|                     "@"+str(user), | ||||
|                     CONF['MESSAGE']['WIKITON'] | ||||
|                 ) | ||||
| 
 | ||||
|             elif msg.startswith('!wtoff'): | ||||
|                 logging.info('Wiki TTS is now turned off') | ||||
|                 self.wikitts['status'] = False | ||||
|                 self.sendmsg( | ||||
|                     CONF['IRC_CHANNEL'], | ||||
|                     "@"+str(user), | ||||
|                     CONF['MESSAGE']['WIKITOFF'] | ||||
|                 ) | ||||
| 
 | ||||
|             elif msg.startswith('!pick') and CONF['FEATURE']['PICK']: | ||||
|                 logging.debug("!pick command detected") | ||||
|                 self.__pickcmd(msg) | ||||
|  | @ -693,7 +714,7 @@ class IRC: | |||
|                 "queuetime": datetime.datetime.now(), | ||||
|                 "timestamp": str(time.time_ns()) | ||||
|             } | ||||
|             if CONF['FEATURE']['WIKITTS']: | ||||
|             if self.wikitts['status']: | ||||
|                 msg_queue[raw_msg['timestamp']] = [raw_msg['user'], raw_msg['msg']] | ||||
| 
 | ||||
|         except wikipedia.exceptions.DisambiguationError: | ||||
|  | @ -1420,6 +1441,12 @@ def load_config(): | |||
|             CONF['MESSAGE']['TON'] = cfg.get('messages', {}).get( | ||||
|                 'ton', "TTS is now active." | ||||
|             ) | ||||
|             CONF['MESSAGE']['WIKITOFF'] = cfg.get('messages', {}).get( | ||||
|                 'wikitoff', "Wiki TTS is now disabled." | ||||
|             ) | ||||
|             CONF['MESSAGE']['WIKITON'] = cfg.get('messages', {}).get( | ||||
|                 'wikiton', "Wiki TTS is now active." | ||||
|             ) | ||||
|             CONF['MESSAGE']['TOO_LONG'] = cfg.get('messages', {}).get( | ||||
|                 'too_long', "Sorry, your message is too long." | ||||
|             ) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue