Compare commits

..

3 commits

Author SHA1 Message Date
dece b7b6ca71be wikipedia: catch all filthy exceptions 2021-06-11 11:31:45 +02:00
dece 5ca4a25b1f bot: graceful exception catch 2021-06-11 11:28:22 +02:00
dece 19e5408ba2 youtube_parser: remove annoying logs 2021-06-11 11:27:11 +02:00
3 changed files with 4 additions and 4 deletions

View file

@ -114,6 +114,8 @@ class Bot(irc.client.SimpleIRCClient, Logger):
try:
self.start()
except KeyboardInterrupt:
self.log_i("Caught keyboard interrupt.")
finally:
self.log_i("Stopping Edmond.")
self.__save_storage()

View file

@ -40,7 +40,7 @@ class WikipediaPlugin(Plugin):
try:
summary = wikipedia.summary(wikipedia.random(), sentences=1)
break
except wikipedia.exceptions.WikipediaException:
except: # The wikipedia package can raise a lot of different stuff.
pass
retries -= 1
if summary:
@ -59,7 +59,7 @@ class WikipediaPlugin(Plugin):
except wikipedia.exceptions.PageError:
summary = self.config["empty_response"]
break
except wikipedia.exceptions.WikipediaException:
except:
summary = self.bot.config["error_message"]
# Keep trying after a slight delay.
time.sleep(1)

View file

@ -35,10 +35,8 @@ class YoutubeParserPlugin(Plugin):
def on_pubmsg(self, event):
words = event.arguments[0].split()
for word in words:
self.bot.log_d("testing " + word)
match = self.VIDEO_URL_RE.match(word)
if match:
self.bot.log_d("match!")
return self.handle_match(match, event.target)
return False