added timeout to isup.py, made -m work for .pickmovie, fixed xkcd.py

This commit is contained in:
iou1name 2018-04-24 20:07:25 -04:00
parent c3820a445d
commit ff4c71253c
3 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ def isup(bot, trigger):
url = "http://" + url url = "http://" + url
try: try:
res = requests.head(url, verify=True) res = requests.head(url, timeout=10, verify=True)
except (requests.exceptions.MissingSchema, except (requests.exceptions.MissingSchema,
requests.exceptions.InvalidSchema): requests.exceptions.InvalidSchema):
return bot.say("Missing or invalid schema. Check the URL.") return bot.say("Missing or invalid schema. Check the URL.")

View File

@ -151,11 +151,11 @@ def pickMovie(bot, trigger):
bot.reply(movie[0]) bot.reply(movie[0])
if trigger.group(2) == "-m": if trigger.group(2) == "-m":
trigger.set_group(f".movie {movie}") trigger.set_group(f".movie {movie}", bot.config)
movieInfo(bot, trigger) movieInfo(bot, trigger)
@require_admin # @require_admin
@commands('addmovie') @commands('addmovie')
@example('.addmovie Gay Niggers From Outer Space') @example('.addmovie Gay Niggers From Outer Space')
def addMovie(bot, trigger): def addMovie(bot, trigger):

View File

@ -74,7 +74,7 @@ def get_url(bot, url):
"""Callback for the URL module.""" """Callback for the URL module."""
_, _, num = url.partition("xkcd.com/") _, _, num = url.partition("xkcd.com/")
try: try:
num = int(num) num = int(num.replace("/", ""))
except ValueError: except ValueError:
return return
latest = get_info() latest = get_info()