Fix clear avatar bug

Fixes a bug in member_avatar() where the bot will try to check for an attachment via list index when attachments do not exist.
This commit is contained in:
Bella | Nightshade 2019-06-29 20:12:17 +09:30 committed by Astrid
parent 15ccc4e27a
commit 214a6d5a49

View File

@ -129,7 +129,7 @@ async def member_avatar(ctx: CommandContext, member: Member):
if user: if user:
new_avatar_url = user.avatar_url_as(format="png") new_avatar_url = user.avatar_url_as(format="png")
if not new_avatar_url and ctx.message.attachments[0]: if not new_avatar_url and ctx.message.attachments:
new_avatar_url = ctx.message.attachments[0].url new_avatar_url = ctx.message.attachments[0].url
await member.set_avatar(ctx.conn, new_avatar_url) await member.set_avatar(ctx.conn, new_avatar_url)