From 1f367fd2df4135761ff100afc5769a51984df99d Mon Sep 17 00:00:00 2001
From: Romain J <romain.ordi@gmail.com>
Date: Thu, 22 Apr 2021 14:54:46 +0200
Subject: [PATCH] fix(commands:getheaders|Network): prevent fails for missing
[] on v6
---
README.rst | 6 +++---
tuxbot/cogs/Logs/logs.py | 3 +--
tuxbot/cogs/Network/network.py | 10 +++++++---
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/README.rst b/README.rst
index c80cc34..c7c3b71 100644
--- a/README.rst
+++ b/README.rst
@@ -14,7 +14,7 @@ Installing the pre-requirements
- The pre-requirements are:
- - Python 3.9 or greater
+ - Python 3.10 or greater
- Pip
- Git
@@ -118,12 +118,12 @@ Configuration
It's time to set up your first instance, to do this, you can simply
execute this command:
-:bash:`tuxbot-setup [your instance name]`
+:bash:`tuxbot-setup`
After following the instructions, you can run your instance by executing
this command:
-:bash:`tuxbot [your instance name]`
+:bash:`tuxbot`
Update
------
diff --git a/tuxbot/cogs/Logs/logs.py b/tuxbot/cogs/Logs/logs.py
index 42d5445..190051d 100644
--- a/tuxbot/cogs/Logs/logs.py
+++ b/tuxbot/cogs/Logs/logs.py
@@ -239,8 +239,6 @@ class Logs(commands.Cog):
if isinstance(error, (discord.Forbidden, discord.NotFound)):
return
- if self.bot.instance_name != "dev":
- sentry_sdk.capture_exception(error)
self.bot.console.log(
"Command Error, check sentry or discord error channel"
)
@@ -282,6 +280,7 @@ class Logs(commands.Cog):
e.remove_field(1)
if self.bot.instance_name != "dev":
+ sentry_sdk.capture_exception(error)
e.set_footer(text=sentry_sdk.last_event_id())
await ctx.send(embed=e)
diff --git a/tuxbot/cogs/Network/network.py b/tuxbot/cogs/Network/network.py
index 7c8a32b..9cb83c0 100644
--- a/tuxbot/cogs/Network/network.py
+++ b/tuxbot/cogs/Network/network.py
@@ -5,7 +5,7 @@ from typing import Optional
import aiohttp
import discord
-from aiohttp import ClientConnectorError
+from aiohttp import ClientConnectorError, InvalidURL
from jishaku.models import copy_context_with
from discord.ext import commands
from ipinfo.exceptions import RequestQuotaExceededError
@@ -170,7 +170,7 @@ class Network(commands.Cog):
"5": 0x343A40,
}
- async with ctx.session.get(
+ async with self.bot.session.get(
str(ip),
headers=headers,
timeout=aiohttp.ClientTimeout(total=8),
@@ -202,7 +202,11 @@ class Network(commands.Cog):
e.add_field(name=key, value=value, inline=True)
await ctx.send(embed=e)
- except (ClientConnectorError, asyncio.exceptions.TimeoutError):
+ except (
+ ClientConnectorError,
+ InvalidURL,
+ asyncio.exceptions.TimeoutError,
+ ):
await ctx.send(
_("Cannot connect to host {}", ctx, self.bot.config).format(ip)
)