mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
[V3 Streams] Replace instances of ClientSession assignment with async context manager (#1238)
This commit is contained in:
@@ -293,10 +293,9 @@ class Core:
|
||||
@checks.is_owner()
|
||||
async def avatar(self, ctx, url: str):
|
||||
"""Sets Red's avatar"""
|
||||
session = aiohttp.ClientSession()
|
||||
async with session.get(url) as r:
|
||||
data = await r.read()
|
||||
await session.close()
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url) as r:
|
||||
data = await r.read()
|
||||
|
||||
try:
|
||||
await ctx.bot.user.edit(avatar=data)
|
||||
|
||||
Reference in New Issue
Block a user