From 4565caa09fcddf2ccc9cc28dd1c3bcd68d6acd1e Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Fri, 9 Mar 2018 17:36:23 -0800 Subject: [PATCH] Had a regression. Cast message.author to a single item list so it can still iterate --- app/dragon-bot.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/dragon-bot.py b/app/dragon-bot.py index 89d51ba7..a6f3e526 100644 --- a/app/dragon-bot.py +++ b/app/dragon-bot.py @@ -82,19 +82,20 @@ async def on_message(message): ) if message.content.startswith('!avatar'): - profile = message.author + profile = [message.author] if len(message.mentions): - profile = message.mentions[0] + profile = message.mentions # Code stolen from this reddit post # https://www.reddit.com/r/discordapp/comments/74bb4z/retrieve_a_mentioned_users_avatar_using_discordpy - embed = discord.Embed( - title="{}#{}".format(profile.name, profile.discriminator), - description="[Direct Link]({})".format(profile.avatar_url), - type='rich' - ) - embed.set_image(url=profile.avatar_url) - await client.send_message(message.channel, embed=embed) + for user in profile: + embed = discord.Embed( + title="{}#{}".format(user.name, user.discriminator), + description="[Direct Link]({})".format(user.avatar_url), + type='rich' + ) + embed.set_image(url=user.avatar_url) + await client.send_message(message.channel, embed=embed) if message.content.startswith('!cleanup'): if not role_check.cleanup_permissions(message.author.roles):