Update system_commands.py

Adding ability to get avatar from an attachment
This commit is contained in:
Grey Himmel 2019-04-30 19:42:14 -04:00 committed by GitHub
parent efad860e87
commit 52f7169b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,6 +184,9 @@ async def system_avatar(ctx: CommandContext):
user = await utils.parse_mention(ctx.client, new_avatar_url)
if user:
new_avatar_url = user.avatar_url_as(format="png")
if not new_avatar_url and ctx.message.attachments[0]:
new_avatar_url = ctx.message.attachments[0].url
await system.set_avatar(ctx.conn, new_avatar_url)
await ctx.reply_ok("System avatar {}.".format("updated" if new_avatar_url else "cleared"))