From f76722f9d84aedf92e7ced5eefb459cf52440938 Mon Sep 17 00:00:00 2001 From: Mael G Date: Sun, 28 Jul 2019 18:34:43 -0400 Subject: [PATCH] HTTP error triggering --- bot.py | 1 + cogs/utility.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 6fce9fc..bc5e67a 100755 --- a/bot.py +++ b/bot.py @@ -37,6 +37,7 @@ l_extensions = ( 'cogs.sondage', 'cogs.utility', 'cogs.vocal', + 'cogs.private', ) help_attrs = dict(hidden=True, in_help=True, name="DONOTUSE") diff --git a/cogs/utility.py b/cogs/utility.py index 6bf639e..735cce7 100755 --- a/cogs/utility.py +++ b/cogs/utility.py @@ -249,7 +249,6 @@ class Utility(commands.Cog): @commands.command(name='getheaders', pass_context=True) async def _getheaders(self, ctx, *, adresse): """Recuperer les HEADERS :d""" - print("Loaded") if adresse.startswith("http://") != True and adresse.startswith("https://") != True: adresse = "http://" + adresse if len(adresse) > 200: @@ -282,6 +281,12 @@ class Utility(commands.Cog): print('''An error occurred: {} The response code was {}'''.format(e, e.getcode())) except urllib.error.URLError as e: print("ERROR @ getheaders @ urlerror : {} - adress {}".format(e, adresse)) + if "No address associated" in str(e): + await ctx.send("Erreur, aucune adresse n'est associé à ce nom d'hôte.") + return + if "timed out" in str(e): + await ctx.send("Erreur, l'adresse en question dépasse le délais d'attente :(") + return await ctx.send('[CONTACTER ADMIN] URLError: {}'.format(e.reason)) except Exception as e: print("ERROR @ getheaders @ Exception : {} - adress {}".format(e, adresse))