mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Handle aiohttp errors in [p]set avatar (#4437)
* [Core comands] Handle aiohttp errors in set avatar * Update redbot/core/core_commands.py Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
parent
4e1ce7524b
commit
343efba4d5
@ -1776,8 +1776,13 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
|
||||
url = url[1:-1]
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(url) as r:
|
||||
data = await r.read()
|
||||
try:
|
||||
async with session.get(url) as r:
|
||||
data = await r.read()
|
||||
except aiohttp.InvalidURL:
|
||||
return await ctx.send(_("That URL is invalid."))
|
||||
except aiohttp.ClientError:
|
||||
return await ctx.send(_("Something went wrong while trying to get the image."))
|
||||
else:
|
||||
await ctx.send_help()
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user