No need to manually close sessions anymore

pull/9/head
sgoudham 4 years ago
parent 10e7764276
commit 7587d41851

@ -78,8 +78,6 @@ async def get_from_api(self, ctx, url):
else:
await self.bot.generate_embed(ctx, desc="**Something went wrong with MyWaifuList!**")
await session.close()
return _dict
@ -419,9 +417,6 @@ class Anime(Cog):
else:
await self.bot.generate_embed(ctx, desc="**Something went wrong with MyWaifuList!**")
# Close session
await session.close()
# As long as data is returned
# Store all data from the api in dict
if len(api_data["data"]) > 0:

@ -349,7 +349,7 @@ class Fun(Cog):
url = "https://apis.duncte123.me/kpop"
async with aiohttp.ClientSession() as session:
async with await session.get(url=url) as response:
# When succesful, read data from json
# When successful, read data from json
if response.status == 200:
kpop = await response.json()
@ -367,8 +367,6 @@ class Fun(Cog):
desc="**You are being rate limited! You have spammed it too much :(**")
return
await session.close()
embed = Embed(title=name,
description=band,
colour=self.bot.random_colour(),
@ -421,8 +419,6 @@ class Fun(Cog):
desc="**You are being rate limited! You have spammed it too much :(**")
return
await session.close()
# Setting bools to ticks/cross emojis
verif = self.bot.tick if verified else self.bot.cross
priv = self.bot.tick if private else self.bot.cross

Loading…
Cancel
Save