Reputation: 43
I made a suggest command but if the user dont add quotes to their sentence it will only pick the first word they typed example: -suggest this is a test. It will only pick the 'This' any fixes for this?
The command code lines:
@client.command()
async def suggest(ctx, suggestion):
channel = client.get_channel(754640430670413835)
embed = discord.Embed(color=0xff0000)
embed.add_field(name="SUGGESTION", value="{} suggested this: ** {} **".format(ctx.author.mention, suggestion), inline=False)
await channel.send(embed=embed)
await ctx.send("Thank you for your suggestion {}".format(ctx.author.mention))
Upvotes: 1
Views: 47
Reputation: 2041
You can ask the library to give you the rest as a single argument. We do this by using a keyword-only argument. Add a *
before your suggestion
parameter.
@client.command()
async def suggest(ctx, *, suggestion):
channel = client.get_channel(754640430670413835)
embed = discord.Embed(color=0xff0000)
embed.add_field(name="SUGGESTION", value="{} suggested this: ** {} **".format(ctx.author.mention, suggestion), inline=False)
await channel.send(embed=embed)
await ctx.send("Thank you for your suggestion {}".format(ctx.author.mention))
Upvotes: 1