1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Added error handling for if the twitch user does not exist

This commit is contained in:
Phxntxm 2016-07-10 10:50:12 -05:00
parent 2f4a7370a6
commit 430aa86e6a

View file

@ -32,7 +32,13 @@ class Twitch:
url="https://www.twitch.tv/{}".format(url)
else:
url="https://www.{}".format(url)
try:
urllib.request.urlopen(url)
except urllib.request.HTTPError:
await self.bot.say("That twitch user does not exist! What would be the point of adding a nonexistant twitch user? Silly")
return
cursor = config.getCursor()
cursor.execute('use {}'.format(config.db_default))
cursor.execute('select twitch_url from twitch where user_id="{}"'.format(ctx.message.author.id))