Fixed weather command
This commit is contained in:
parent
d9bc203053
commit
36e1e93590
2
irc.py
2
irc.py
|
@ -75,7 +75,7 @@ class IRC:
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def shutdown(self, sig=None, frame=None, msg=None):
|
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.shutdown(2) #SHUT_RDWR
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def getweather(bot, channel, message):
|
def getweather(bot, channel, message):
|
||||||
location = message.split()[1:]
|
try:
|
||||||
page = requests.get(f"https://wttr.in/{'+'.join(location)}?format=%l+|+%t+|+%C+|+Humidity:+%h+|+Wind:+%w")
|
location = message.split()[1:]
|
||||||
bot.send(channel, page.text)
|
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")
|
||||||
|
|
Loading…
Reference in New Issue