From 550a2c33e273852791b74d7325340a567e08b52d Mon Sep 17 00:00:00 2001 From: Julian Marcos Date: Fri, 15 Dec 2023 20:50:27 +0000 Subject: [PATCH] Error out tracebacks when util fails The util library originally developed by krowbar and with my modifications isn't the most perfect thing, and I break it a bit. --- plugins/tilde.py | 12 +++++++++--- requirements.txt | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/tilde.py b/plugins/tilde.py index d0067ab..702dab2 100644 --- a/plugins/tilde.py +++ b/plugins/tilde.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import traceback import pinhook.plugin import util.tilde @@ -28,7 +29,12 @@ def tilde_guess_plugin(msg): if util.tilde.ADMIN_ONLY and msg.nick not in msg.ops: return if msg.nick in util.tilde.challenges and (msg.channel == util.tilde.GOOD_CHAN or util.tilde.DEBUG) and not msg.text.startswith('!'): - chalres = util.tilde.challenge_response(msg.nick, msg.timestamp, msg.text) - resp = pinhook.plugin.message(chalres[0]) - return resp + try: + chalres = util.tilde.challenge_response(msg.nick, msg.timestamp, msg.text) + print(chalres) + resp = pinhook.plugin.message(str(chalres[0])) + return resp + except Exception as e: + print(traceback.format_exc()) + return pinhook.plugin.message(str(e)) diff --git a/requirements.txt b/requirements.txt index aab4bd5..ec85b7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,5 @@ requests>~2.20.0 tvdb-api~=1.10 zalgotext~=0.2.0 python-dateutil +traceback +importlib