mirror of https://gitlab.com/gpvkt/twitchtts.git
Added option to disable functions
This commit is contained in:
parent
7d2a85173a
commit
df450f9eaf
|
@ -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.
|
||||
|
||||
## [1.7.0] - 2022-08-27
|
||||
|
||||
### Added 1.7.0
|
||||
|
||||
* Option to disable functions in `config.yml`
|
||||
|
||||
## [1.6.1] - 2022-08-25
|
||||
|
||||
### 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:
|
||||
|
||||
* `!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)
|
||||
* `!ton`: Turn TTS back on
|
||||
* `!dtts <username>`: Disable TTS for the given user
|
||||
|
@ -190,6 +191,21 @@ Additional commands (broadcaster and mods only) are:
|
|||
|
||||
### 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
|
||||
|
||||
A simple vote system.
|
||||
|
|
|
@ -16,6 +16,15 @@ bot:
|
|||
message_length: 200 # Max. TTS message length
|
||||
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
|
||||
toff: "TTS is now inactive."
|
||||
ton: "TTS is now active."
|
||||
|
|
50
tts.py
50
tts.py
|
@ -179,20 +179,21 @@ class IRC:
|
|||
self.Commands.tts(self, message, tags)
|
||||
return
|
||||
|
||||
if msg.startswith('!addquote'):
|
||||
logging.debug("!addquote command detected")
|
||||
self.Commands.addquote(self, tags, msg)
|
||||
return
|
||||
|
||||
if msg.startswith('!wiki'):
|
||||
if msg.startswith('!wiki') and conf['FEATURE']['WIKI']:
|
||||
logging.debug("!wiki command detected")
|
||||
self.Commands.wiki(self, tags, msg)
|
||||
return
|
||||
|
||||
if msg.startswith('!smartquote') or msg.startswith('!sq'):
|
||||
logging.debug("!smartquote command detected")
|
||||
self.Commands.quote(self, tags, msg)
|
||||
return
|
||||
if conf['FEATURE']['QUOTE']:
|
||||
if msg.startswith('!addquote'):
|
||||
logging.debug("!addquote command detected")
|
||||
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):
|
||||
""" Strip tags from response """
|
||||
|
@ -236,27 +237,23 @@ class IRC:
|
|||
user = tags['user']
|
||||
|
||||
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.")
|
||||
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")
|
||||
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")
|
||||
self.Commands.pick(self, msg)
|
||||
|
||||
elif msg.startswith('!dtts'):
|
||||
logging.debug("!dtts command detected")
|
||||
self.Commands.dtts(self, msg)
|
||||
|
||||
elif msg.startswith('!random'):
|
||||
elif msg.startswith('!random') and conf['FEATURE']['RANDOM']:
|
||||
logging.info('!random command detected')
|
||||
self.Commands.random(self, msg)
|
||||
|
||||
elif msg.startswith('!quickvote'):
|
||||
elif msg.startswith('!quickvote') and conf['FEATURE']['QUOTE']:
|
||||
logging.info("!quickvote command detected")
|
||||
self.Commands.quickvote(self, msg)
|
||||
|
||||
|
@ -264,6 +261,10 @@ class IRC:
|
|||
logging.debug("!ptts command detected")
|
||||
self.Commands.ptts(self, msg)
|
||||
|
||||
elif msg.startswith('!dtts'):
|
||||
logging.debug("!dtts command detected")
|
||||
self.Commands.dtts(self, msg)
|
||||
|
||||
elif msg.startswith('!usermap'):
|
||||
logging.info('!usermap command detected')
|
||||
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_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', [])
|
||||
|
||||
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')
|
||||
sys.tracebacklimit = 3
|
||||
|
||||
VERSION = "1.6.1"
|
||||
VERSION = "1.7.0"
|
||||
conf = {}
|
||||
tts_done = []
|
||||
msg_queue_raw = []
|
||||
|
|
Loading…
Reference in New Issue