Is there a way to bypass the restriction in discord.py that if you plan on giving a multi-worded argument to a command, you must cover it in quotes?

Viewed 183

Take this example.

@bot.command()
async def example(ctx, text)
    await ctx.send(text)

And let's say a user uses this command like this:

example Hello world

The bot would send "hello" to the chat. Only if the user covers the sentence in quotes would the bot send the whole sentence.

So, back to my question - is there a way to bypass this "restriction"? I want the program to be able to return the whole sentence even if the user didn't use quotes.

1 Answers

Try this,

Try the * as a parameter in your function, it pushes all the upcoming input to the text parameter

@bot.command()
async def example(ctx, *, text)
    await ctx.send(text)

tell me if its okay for you...

Related