mirror of https://gitlab.com/gpvkt/twitchtts.git
Ease rules on commands
This commit is contained in:
parent
a18a9d1ee4
commit
e22315b192
|
@ -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.
|
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
|
## [1.3.1] - 2022-08-19
|
||||||
|
|
||||||
### Added 1.3.1
|
### Added 1.3.1
|
||||||
|
|
2
build.py
2
build.py
|
@ -41,7 +41,7 @@ print("Waiting for results")
|
||||||
while data['data']['attributes']['status'] != "completed":
|
while data['data']['attributes']['status'] != "completed":
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
print( "[CHK]")
|
print( " [CHK]")
|
||||||
data = req.json()
|
data = req.json()
|
||||||
api_endpoint = f"https://www.virustotal.com/api/v3/analyses/{data['data']['id']}"
|
api_endpoint = f"https://www.virustotal.com/api/v3/analyses/{data['data']['id']}"
|
||||||
headers = {
|
headers = {
|
||||||
|
|
26
tts.py
26
tts.py
|
@ -166,6 +166,14 @@ class IRC:
|
||||||
logging.info('!tts command detected')
|
logging.info('!tts command detected')
|
||||||
self.Commands.tts(self, message, tags)
|
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):
|
def get_tags(self, resp):
|
||||||
""" Strip tags from response """
|
""" Strip tags from response """
|
||||||
|
|
||||||
|
@ -212,14 +220,6 @@ class IRC:
|
||||||
logging.debug("Ping check received.")
|
logging.debug("Ping check received.")
|
||||||
self.sendmsg(conf['IRC_CHANNEL'], "@"+str(user), "Pong!")
|
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'):
|
elif msg.startswith('!dtts'):
|
||||||
logging.debug("!dtts command detected")
|
logging.debug("!dtts command detected")
|
||||||
self.Commands.dtts(self, msg)
|
self.Commands.dtts(self, msg)
|
||||||
|
@ -528,7 +528,7 @@ class IRC:
|
||||||
|
|
||||||
file = open("quotes.txt", "rb")
|
file = open("quotes.txt", "rb")
|
||||||
quotes = file.readlines()
|
quotes = file.readlines()
|
||||||
matches = process.extract(query, quotes, limit=20)
|
matches = process.extract(query, quotes, limit=10)
|
||||||
quotes = []
|
quotes = []
|
||||||
|
|
||||||
for match, score in matches:
|
for match, score in matches:
|
||||||
|
@ -536,8 +536,10 @@ class IRC:
|
||||||
quotes.append(match)
|
quotes.append(match)
|
||||||
|
|
||||||
logging.debug('Quotes: %s', quotes)
|
logging.debug('Quotes: %s', quotes)
|
||||||
if len(quotes) >= 1:
|
if len(quotes) >= 5:
|
||||||
quote = random.choice(quotes)
|
quote = random.choice(quotes)
|
||||||
|
else:
|
||||||
|
quote = quotes[0]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.info('Fetching random quote')
|
logging.info('Fetching random quote')
|
||||||
|
@ -831,7 +833,7 @@ class HTTPserv(BaseHTTPRequestHandler):
|
||||||
for key in list(sorted_tts.keys()):
|
for key in list(sorted_tts.keys()):
|
||||||
if key not in tts_done:
|
if key not in tts_done:
|
||||||
if msg_queue[key][0].lower() in usermap:
|
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])}
|
tts = {str(key): str(usermap[msg_queue[key][0].lower()]) + " " + str(conf['MESSAGE']['SAYS']) + ":" + str(msg_queue[key][1])}
|
||||||
else:
|
else:
|
||||||
logging.debug('No usermap entry found for user: %s', msg_queue[key][0])
|
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:]:
|
||||||
if sys.argv[1] == "--version":
|
if sys.argv[1] == "--version":
|
||||||
print('Simple TTS Bot')
|
print('Simple TTS Bot')
|
||||||
print('Version 1.3.1')
|
print('Version 1.3.2')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue