Eating my own dogfood. Using the embed method for the avatar function
This commit is contained in:
parent
87995bd2fc
commit
90616bbe25
@ -66,14 +66,6 @@ async def on_message(message):
|
||||
"""
|
||||
return m.author == message.author
|
||||
|
||||
if client.user.mentioned_in(message):
|
||||
await client.send_message(
|
||||
message.channel,
|
||||
"{} ```{}```".format(
|
||||
message.author.mention,
|
||||
questions.answer_question(message.content)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def generate_embed(embed_url, embed_title=None, embed_description=None):
|
||||
@ -96,13 +88,22 @@ async def on_message(message):
|
||||
embed.set_image(url=image)
|
||||
return embed
|
||||
|
||||
|
||||
if client.user.mentioned_in(message):
|
||||
await client.send_message(
|
||||
message.channel,
|
||||
"{} ```{}```".format(
|
||||
message.author.mention,
|
||||
questions.answer_question(message.content)
|
||||
)
|
||||
)
|
||||
|
||||
if message.content.startswith('!8ball'):
|
||||
await client.send_message(
|
||||
message.channel,
|
||||
eight_ball.check_8ball(message.content)
|
||||
)
|
||||
|
||||
|
||||
if message.content.startswith('!avatar'):
|
||||
profile = [message.author]
|
||||
if len(message.mentions):
|
||||
@ -111,13 +112,14 @@ async def on_message(message):
|
||||
# Code stolen from this reddit post
|
||||
# https://www.reddit.com/r/discordapp/comments/74bb4z/retrieve_a_mentioned_users_avatar_using_discordpy
|
||||
for user in profile:
|
||||
embed = discord.Embed(
|
||||
title="{}#{}".format(user.name, user.discriminator),
|
||||
description="[Direct Link]({})".format(user.avatar_url.replace('.webp', '.png')),
|
||||
type='rich'
|
||||
await client.send_message(
|
||||
message.channel,
|
||||
embed=generate_embed(
|
||||
embed_title="{}#{}".format(user.name, user.discriminator),
|
||||
embed_url=user.avatar_url.replace('.webp', '.png'),
|
||||
embed_description="[Direct Link]({})".format(user.avatar_url.replace('.webp', '.png'))
|
||||
)
|
||||
)
|
||||
embed.set_image(url=user.avatar_url.replace('.webp', '.png'))
|
||||
await client.send_message(message.channel, embed=embed)
|
||||
|
||||
if message.content.startswith('!clap'):
|
||||
await client.delete_message(message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user