Jack Thorn
Jack Thorn

Reputation: 67

Discord.py embed is only showing one word

So I'm trying to make a !say (message goes here) command for my discord bot. Here's the code I've got so far:

async def say(ctx, message):
    embed=discord.Embed(title="New Say Message", description=(message), color=0xff0000)
    await ctx.send(embed=embed)

If I do "!say Hello", it works fine. However, if I do "!say How are you", it just shows the word "How" in the embed. Here's what I mean: https://gyazo.com/b146fff6c1d7c99a47db9c218dd753f1.

What do I need to do/change to make it show the full message. Thanks!

Upvotes: 0

Views: 483

Answers (1)

Flair
Flair

Reputation: 2907

Your function signature is set up incorrectly. You only accept one argument from the bot with async def say(ctx, message); in order to consume a variable-length of arguments in python, you need *. Then you would consume that variable length as a list.

Example:

async def say(ctx, *message):
    embed=discord.Embed(title="New Say Message", description=(" ".join(message)), color=0xff0000)
    await ctx.send(embed=embed)

Upvotes: 1

Related Questions