Return the users avatar if no username is specified
This commit is contained in:
parent
895eb6d8fa
commit
b7af111207
@ -81,17 +81,20 @@ async def on_message(message):
|
|||||||
eight_ball.check_8ball(message.content)
|
eight_ball.check_8ball(message.content)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (message.content.startswith('!avatar') and message.mentions.__len__() > 0 ):
|
if message.content.startswith('!avatar'):
|
||||||
|
profile = message.author
|
||||||
|
if len(message.mentions):
|
||||||
|
profile = message.mentions[0]
|
||||||
|
|
||||||
# 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
|
||||||
for user in message.mentions:
|
embed = discord.Embed(
|
||||||
embed = discord.Embed(
|
title="{}#{}".format(profile.name, profile.discriminator),
|
||||||
title="{}#{}".format(user.name,user.discriminator),
|
description="[Direct Link]({})".format(profile.avatar_url),
|
||||||
description="[Direct Link]({})".format(user.avatar_url),
|
type='rich'
|
||||||
type='rich'
|
)
|
||||||
)
|
embed.set_image(url=profile.avatar_url)
|
||||||
embed.set_image(url=user.avatar_url)
|
await client.send_message(message.channel, embed=embed)
|
||||||
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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user