adding meme. fixes #19

This commit is contained in:
Luke Robles 2020-09-01 19:30:20 -07:00
parent e868f23bd9
commit cd113f139a

View File

@ -132,13 +132,14 @@ async def emoji(ctx):
import core_utils import core_utils
emoji_staging = '/tmp/emoji' emoji_staging = '/tmp/emoji'
await ctx.send("emoji successfully uploaded! Heres how it looks in a sentence {}\nUse it with `:{}:`".format( try:
await ctx.message.guild.create_custom_emoji( await ctx.send("emoji successfully uploaded! Heres how it looks in a sentence {}\nUse it with `:{}:`".format(
name=emoji_name, await ctx.message.guild.create_custom_emoji(
image=open(core_utils.download_image(url, emoji_staging), "rb").read() name=emoji_name,
), emoji_name image=open(core_utils.download_image(url, emoji_staging), "rb").read()
), emoji_name
)
) )
)
except Exception: except Exception:
await ctx.send( await ctx.send(
"I wasnt able to upload that image as an emoji. Sorry" "I wasnt able to upload that image as an emoji. Sorry"
@ -155,14 +156,28 @@ async def avatar(ctx):
# 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 profile: for user in profile:
avatar_url = str(user.avatar_url).replace('.webp', '.png')
await ctx.send( await ctx.send(
embed=generate_embed( embed=generate_embed(
embed_title="{}#{}".format(user.name, user.discriminator), embed_title="{}#{}".format(user.name, user.discriminator),
embed_url=str(user.avatar_url).replace('.webp', '.png'), embed_url=avatar_url,
embed_description="[Direct Link]({})".format(str(user.avatar_url).replace('.webp', '.png')) embed_description="[Direct Link]({})".format(avatar_url)
) )
) )
@bot.command(name='meme')
async def meme(ctx):
import meme_gen
await ctx.message.delete()
await ctx.send(
embed=generate_embed(
embed_url=meme_gen.parse_message(
ctx.message.content
)
)
)
@bot.command(name='redpanda') @bot.command(name='redpanda')
async def redpanda(ctx): async def redpanda(ctx):