Had a regression. Cast message.author to a single item list so it can still iterate

This commit is contained in:
Luke Robles 2018-03-09 17:36:23 -08:00
parent b7af111207
commit 818bad1c54

View File

@ -82,19 +82,20 @@ async def on_message(message):
) )
if message.content.startswith('!avatar'): if message.content.startswith('!avatar'):
profile = message.author profile = [message.author]
if len(message.mentions): if len(message.mentions):
profile = message.mentions[0] profile = message.mentions
# Code stolen from this reddit post # Code stolen from this reddit post
# https://www.reddit.com/r/discordapp/comments/74bb4z/retrieve_a_mentioned_users_avatar_using_discordpy # https://www.reddit.com/r/discordapp/comments/74bb4z/retrieve_a_mentioned_users_avatar_using_discordpy
embed = discord.Embed( for user in profile:
title="{}#{}".format(profile.name, profile.discriminator), embed = discord.Embed(
description="[Direct Link]({})".format(profile.avatar_url), title="{}#{}".format(user.name, user.discriminator),
type='rich' description="[Direct Link]({})".format(user.avatar_url),
) type='rich'
embed.set_image(url=profile.avatar_url) )
await client.send_message(message.channel, embed=embed) embed.set_image(url=user.avatar_url)
await client.send_message(message.channel, embed=embed)
if message.content.startswith('!cleanup'): if message.content.startswith('!cleanup'):
if not role_check.cleanup_permissions(message.author.roles): if not role_check.cleanup_permissions(message.author.roles):