Facing issues with a discord.py "hug command"
There are two mistakes when you are trying to create the discord.Embed
:
-
When passing the arguments to the
discord.Embed
object, you are starting the initializer with a[
, which should be changed to(
. In Python the[
and]
shall be used only to create a list or to reference any of its positions. -
You are using a dot
.
as separator for the different arguments taken by the constructor ofdiscord.Embed
, but that should be a comma,
.
Here is your corrected code:
hug_gifs = ['https://c.tenor.com/nHkiUCkS04gAAAAC/anime-hug-hearts.gif']
hug_names = ['Hugs you!']
@bot.command()
async def hug(ctx):
embed = discord.Embed (
colour=(discord.Colour.red()),
description = f"{ctx.author.mention} {(random.choice(hug_names))}"
)
embed.set_image(url=(random.choice(hug_gifs)))
await ctx.send(embed = embed)