Ease rules on commands

This commit is contained in:
gpkvt 2022-08-19 04:38:19 +02:00
parent a18a9d1ee4
commit e22315b192
4 changed files with 21 additions and 13 deletions

View File

@ -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.3.2] - 2022-08-20
### Fixed 1.3.2
* `!smartquote` and `!addquote` are not longer Mods only.
## [1.3.1] - 2022-08-19
### Added 1.3.1

BIN
tts.exe

Binary file not shown.

26
tts.py
View File

@ -166,6 +166,14 @@ class IRC:
logging.info('!tts command detected')
self.Commands.tts(self, message, tags)
if msg.startswith('!addquote'):
logging.debug("!addquote command detected")
self.Commands.addquote(self, tags, msg)
if msg.startswith('!smartquote'):
logging.debug("!smartquote command detected")
self.Commands.quote(self, tags, msg)
def get_tags(self, resp):
""" Strip tags from response """
@ -212,14 +220,6 @@ class IRC:
logging.debug("Ping check received.")
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), "Pong!")
if msg.startswith('!addquote'):
logging.debug("!addquote command detected")
self.Commands.addquote(self, tags, msg)
if msg.startswith('!smartquote'):
logging.debug("!smartquote command detected")
self.Commands.quote(self, tags, msg)
elif msg.startswith('!dtts'):
logging.debug("!dtts command detected")
self.Commands.dtts(self, msg)
@ -528,7 +528,7 @@ class IRC:
file = open("quotes.txt", "rb")
quotes = file.readlines()
matches = process.extract(query, quotes, limit=20)
matches = process.extract(query, quotes, limit=10)
quotes = []
for match, score in matches:
@ -536,8 +536,10 @@ class IRC:
quotes.append(match)
logging.debug('Quotes: %s', quotes)
if len(quotes) >= 1:
if len(quotes) >= 5:
quote = random.choice(quotes)
else:
quote = quotes[0]
else:
logging.info('Fetching random quote')
@ -831,7 +833,7 @@ class HTTPserv(BaseHTTPRequestHandler):
for key in list(sorted_tts.keys()):
if key not in tts_done:
if msg_queue[key][0].lower() in usermap:
logging.info('Using usermap for user: %s (%s)', msg_queue[key][0], usermap[msg_queue[key][0].lower()])
logging.debug('Using usermap for user: %s (%s)', msg_queue[key][0], usermap[msg_queue[key][0].lower()])
tts = {str(key): str(usermap[msg_queue[key][0].lower()]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
else:
logging.debug('No usermap entry found for user: %s', msg_queue[key][0])
@ -1106,7 +1108,7 @@ if __name__ == "__main__":
if sys.argv[1:]:
if sys.argv[1] == "--version":
print('Simple TTS Bot')
print('Version 1.3.1')
print('Version 1.3.2')
sys.exit(1)
main()