mirror of
				https://gitlab.com/gpvkt/twitchtts.git
				synced 2025-10-31 09:07:34 +01:00 
			
		
		
		
	Added config options for !wiki
This commit is contained in:
		
							parent
							
								
									591909a94c
								
							
						
					
					
						commit
						83811df8c1
					
				
					 4 changed files with 43 additions and 5 deletions
				
			
		
							
								
								
									
										10
									
								
								CHANGELOG.md
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								CHANGELOG.md
									
										
									
									
									
								
							|  | @ -2,12 +2,18 @@ | ||||||
| 
 | 
 | ||||||
| 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`. | 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.7.4] | ## [1.8.0] | ||||||
| 
 | 
 | ||||||
| ### Changed 1.7.4 | ### Added 1.8.0 | ||||||
|  | 
 | ||||||
|  | * Option to disable TTS audio output for !wiki function | ||||||
|  | * Option to configure the number of sentences fetched by !wiki function | ||||||
|  | 
 | ||||||
|  | ### Changed 1.8.0 | ||||||
| 
 | 
 | ||||||
| * "oauth_token doesn't need to start with "oauth:" anymore | * "oauth_token doesn't need to start with "oauth:" anymore | ||||||
| * Improved oauth-token detection | * Improved oauth-token detection | ||||||
|  | * Improved README.md | ||||||
| 
 | 
 | ||||||
| ## [1.7.3] - 2022-10-20 | ## [1.7.3] - 2022-10-20 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										23
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								README.md
									
										
									
									
									
								
							|  | @ -55,6 +55,17 @@ bot: | ||||||
|   message_length: 200 |   message_length: 200 | ||||||
|   language: de |   language: de | ||||||
| 
 | 
 | ||||||
|  | features: | ||||||
|  |   quote: True | ||||||
|  |   pick: True | ||||||
|  |   vote: True | ||||||
|  |   wiki: True | ||||||
|  |   wikitts: True | ||||||
|  |   wikisentences: 3 | ||||||
|  |   random: True | ||||||
|  |   version: True | ||||||
|  |   ping: True | ||||||
|  | 
 | ||||||
| messages: | messages: | ||||||
|   toff: "TTS is now inactive." |   toff: "TTS is now inactive." | ||||||
|   ton: "TTS is now active." |   ton: "TTS is now active." | ||||||
|  | @ -116,6 +127,17 @@ Please note that the `oauth_token` is valid for approximately 60 days. If it bec | ||||||
| * `message_length`: Maximum allowed message length for TTS | * `message_length`: Maximum allowed message length for TTS | ||||||
| * `language`: Language for `!wiki` command | * `language`: Language for `!wiki` command | ||||||
| 
 | 
 | ||||||
|  | ##### features | ||||||
|  | 
 | ||||||
|  | * `quote`: Enable/Disable `!quote` function | ||||||
|  | * `pick`: Enable/Disable `!pick` function | ||||||
|  | * `wiki`: Enable/Disable `!wiki` function | ||||||
|  | * `wikitts`: Enable/Disable audio output for `!wiki` function | ||||||
|  | * `wikisentences`: Number of sentences fetched by `!wiki` function | ||||||
|  | * `random`: Enable/Disable `!random` function | ||||||
|  | * `version`: Enable/Disable `!version` function | ||||||
|  | * `ping`: Enable/Disable `!ping` function | ||||||
|  | 
 | ||||||
| ##### messages | ##### messages | ||||||
| 
 | 
 | ||||||
| * `toff`: The bots reply when `!toff` is used. | * `toff`: The bots reply when `!toff` is used. | ||||||
|  | @ -199,6 +221,7 @@ features: | ||||||
|   pick: False |   pick: False | ||||||
|   vote: False |   vote: False | ||||||
|   wiki: False |   wiki: False | ||||||
|  |   wikitts: False | ||||||
|   random: False |   random: False | ||||||
|   version: True |   version: True | ||||||
|   ping: True |   ping: True | ||||||
|  |  | ||||||
|  | @ -21,6 +21,8 @@ features: | ||||||
|   pick: True |   pick: True | ||||||
|   vote: True |   vote: True | ||||||
|   wiki: True |   wiki: True | ||||||
|  |   wikitts: True | ||||||
|  |   wikisentences: 3 | ||||||
|   random: True |   random: True | ||||||
|   version: True |   version: True | ||||||
|   ping: True |   ping: True | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								tts.py
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								tts.py
									
										
									
									
									
								
							|  | @ -668,7 +668,7 @@ class IRC: | ||||||
|             user = tags['user'] |             user = tags['user'] | ||||||
|             wikipedia.set_lang(CONF['WIKI_LANG']) |             wikipedia.set_lang(CONF['WIKI_LANG']) | ||||||
|             msg = msg.replace('!wiki', '').strip() |             msg = msg.replace('!wiki', '').strip() | ||||||
|             wikiresult = wikipedia.summary(msg, sentences=3) |             wikiresult = wikipedia.summary(msg, sentences=CONF['FEATURE']['WIKISENTENCES']) | ||||||
| 
 | 
 | ||||||
|             self.sendmsg( |             self.sendmsg( | ||||||
|                 CONF['IRC_CHANNEL'], |                 CONF['IRC_CHANNEL'], | ||||||
|  | @ -693,7 +693,8 @@ class IRC: | ||||||
|                 "queuetime": datetime.datetime.now(), |                 "queuetime": datetime.datetime.now(), | ||||||
|                 "timestamp": str(time.time_ns()) |                 "timestamp": str(time.time_ns()) | ||||||
|             } |             } | ||||||
|             msg_queue[raw_msg['timestamp']] = [raw_msg['user'], raw_msg['msg']] |             if CONF['FEATURE']['WIKITTS']: | ||||||
|  |                 msg_queue[raw_msg['timestamp']] = [raw_msg['user'], raw_msg['msg']] | ||||||
| 
 | 
 | ||||||
|         except wikipedia.exceptions.DisambiguationError: |         except wikipedia.exceptions.DisambiguationError: | ||||||
|             user = f"@{user}" |             user = f"@{user}" | ||||||
|  | @ -1492,6 +1493,12 @@ def load_config(): | ||||||
|             CONF['FEATURE']['WIKI'] = cfg.get('features', {}).get( |             CONF['FEATURE']['WIKI'] = cfg.get('features', {}).get( | ||||||
|                 'wiki', True |                 'wiki', True | ||||||
|             ) |             ) | ||||||
|  |             CONF['FEATURE']['WIKITTS'] = cfg.get('features', {}).get( | ||||||
|  |                 'wikitts', True | ||||||
|  |             ) | ||||||
|  |             CONF['FEATURE']['WIKISENTENCES'] = cfg.get('features', {}).get( | ||||||
|  |                 'wikisentences', 3 | ||||||
|  |             ) | ||||||
|             CONF['FEATURE']['PICK'] = cfg.get('features', {}).get( |             CONF['FEATURE']['PICK'] = cfg.get('features', {}).get( | ||||||
|                 'pick', True |                 'pick', True | ||||||
|             ) |             ) | ||||||
|  | @ -1619,7 +1626,7 @@ if __name__ == "__main__": | ||||||
| 
 | 
 | ||||||
|     sys.tracebacklimit = 3 |     sys.tracebacklimit = 3 | ||||||
| 
 | 
 | ||||||
|     VERSION = "1.7.4" |     VERSION = "1.8.0" | ||||||
|     CONF = {} |     CONF = {} | ||||||
|     tts_done = [] |     tts_done = [] | ||||||
|     MSG_QUEUE_RAW = [] |     MSG_QUEUE_RAW = [] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue