Tony
Tony

Reputation: 326

Discord.py Send a specified, by the discord user, message to a channel

Is it possible to get the user's input and then return it? This is my concept:

@bot.command()
async def return(ctx, *msg):
    await ctx.send(msg)

let's say that the user types: !return Some message specified by the user

but this returns: ('Some', 'message', 'specified', 'by', 'the', 'user')

So, is it possible to make it return: Some message specified by the user?

Upvotes: 0

Views: 41

Answers (1)

LoahL
LoahL

Reputation: 2613

You can use the * separated with a comma to make this work:

@bot.command()
async def return(ctx, *, msg):
    await ctx.send(msg)

Reference: Keyword only arguments

Upvotes: 1

Related Questions