silence any errors here (in case API is down so it doesnt affect audio)

This commit is contained in:
Drapersniper
2020-09-30 11:00:28 +01:00
parent 318a006dac
commit 506c0998ef

View File

@@ -153,12 +153,13 @@ class GlobalCacheWrapper:
if not self.cog.global_api_user.get("can_delete"): if not self.cog.global_api_user.get("can_delete"):
return return
api_url = f"{_API_URL}api/v2/queries/es/id" api_url = f"{_API_URL}api/v2/queries/es/id"
async with self.session.delete( with contextlib.suppress(Exception):
api_url, async with self.session.delete(
headers={"Authorization": self.api_key, "X-Token": self._handshake_token}, api_url,
params={"id": id}, headers={"Authorization": self.api_key, "X-Token": self._handshake_token},
) as r: params={"id": id},
await r.read() ) as r:
await r.read()
async def get_perms(self): async def get_perms(self):
global_api_user = copy(self.cog.global_api_user) global_api_user = copy(self.cog.global_api_user)
@@ -166,7 +167,7 @@ class GlobalCacheWrapper:
is_enabled = await self.config.global_db_enabled() is_enabled = await self.config.global_db_enabled()
if (not is_enabled) or self.api_key is None: if (not is_enabled) or self.api_key is None:
return global_api_user return global_api_user
with contextlib.suppress(aiohttp.ContentTypeError, asyncio.TimeoutError): with contextlib.suppress(Exception):
async with aiohttp.ClientSession(json_serialize=json.dumps) as session: async with aiohttp.ClientSession(json_serialize=json.dumps) as session:
async with session.get( async with session.get(
f"{_API_URL}api/v2/users/me", f"{_API_URL}api/v2/users/me",