diff --git a/CHANGELOG.md b/CHANGELOG.md index a36c4fb..b47cb16 100644 --- a/CHANGELOG.md +++ b/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`. -## [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 * Improved oauth-token detection +* Improved README.md ## [1.7.3] - 2022-10-20 diff --git a/README.md b/README.md index 48f49f1..e49e1e8 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,17 @@ bot: message_length: 200 language: de +features: + quote: True + pick: True + vote: True + wiki: True + wikitts: True + wikisentences: 3 + random: True + version: True + ping: True + messages: toff: "TTS is now inactive." 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 * `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 * `toff`: The bots reply when `!toff` is used. @@ -199,6 +221,7 @@ features: pick: False vote: False wiki: False + wikitts: False random: False version: True ping: True diff --git a/config-dist.yml b/config-dist.yml index 846ec7c..6f45018 100644 --- a/config-dist.yml +++ b/config-dist.yml @@ -21,6 +21,8 @@ features: pick: True vote: True wiki: True + wikitts: True + wikisentences: 3 random: True version: True ping: True diff --git a/tts.py b/tts.py index 79c0bf3..5647680 100644 --- a/tts.py +++ b/tts.py @@ -668,7 +668,7 @@ class IRC: user = tags['user'] wikipedia.set_lang(CONF['WIKI_LANG']) msg = msg.replace('!wiki', '').strip() - wikiresult = wikipedia.summary(msg, sentences=3) + wikiresult = wikipedia.summary(msg, sentences=CONF['FEATURE']['WIKISENTENCES']) self.sendmsg( CONF['IRC_CHANNEL'], @@ -693,7 +693,8 @@ class IRC: "queuetime": datetime.datetime.now(), "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: user = f"@{user}" @@ -1492,6 +1493,12 @@ def load_config(): CONF['FEATURE']['WIKI'] = cfg.get('features', {}).get( '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( 'pick', True ) @@ -1619,7 +1626,7 @@ if __name__ == "__main__": sys.tracebacklimit = 3 - VERSION = "1.7.4" + VERSION = "1.8.0" CONF = {} tts_done = [] MSG_QUEUE_RAW = []