From 36e1e93590e3caaaf9876e75d1d08a7ca8d9199e Mon Sep 17 00:00:00 2001 From: g1n Date: Sat, 18 Dec 2021 15:35:11 +0000 Subject: [PATCH] Fixed weather command --- irc.py | 2 +- weather.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/irc.py b/irc.py index 4a618bd..e3142e2 100644 --- a/irc.py +++ b/irc.py @@ -75,7 +75,7 @@ class IRC: return resp def shutdown(self, sig=None, frame=None, msg=None): - self.rawsend(b"QUIT Catched SIGINT\n") if msg == None else self.rawsend(bytes(f"QUIT bye\n", "UTF-8")) + self.rawsend(b"QUIT Caught SIGINT\n") if msg == None else self.rawsend(bytes(f"QUIT bye\n", "UTF-8")) self.sock.shutdown(2) #SHUT_RDWR self.sock.close() sys.exit(0) diff --git a/weather.py b/weather.py index d1f59e0..9daf379 100644 --- a/weather.py +++ b/weather.py @@ -1,6 +1,9 @@ import requests def getweather(bot, channel, message): - location = message.split()[1:] - page = requests.get(f"https://wttr.in/{'+'.join(location)}?format=%l+|+%t+|+%C+|+Humidity:+%h+|+Wind:+%w") - bot.send(channel, page.text) + try: + location = message.split()[1:] + page = requests.get(f"http://wttr.in/{'+'.join(location)}?format=%l+|+%t+|+%C+|+Humidity:+%h+|+Wind:+%w") + bot.send(channel, page.text) + except: + bot.send(channel, "Failed to get weather")