So I'm making a bot with discord.py and I have left a bounty saying that anyone who can solve the riddle gets 50$, Now I want my users to post their answer to the bot in the dms, and this is the code i wrote!
@client.command()
async def answer(ctx, answer):
print(Fore.LIGHTGREEN_EX + "[" + current_time + "] " + (ctx.author.name +"#"+ ctx.author.discriminator) + " Gave the Following Answer: " + answer)
await ctx.author.send("**`Your Answer Has Been Submitted, Please Be Patient As We Review!`**")
await ctx.author.send("Your Answer is: " + answer)
Now the thing about this is, it takes only the first word as the answer, while I want the bot to send the entire thing to me, how do I do that?
I tried using string indexes like answer[0:]
and also tried adding str to the answer, nothing works...
Since you're using @client.command
, this is documented within Discord.py's documentation (example lifted from the documentation page):
@bot.command()
async def test(ctx, *, arg):
await ctx.send(arg)
In your case,
@client.command()
async def answer(ctx, *, answer):
print(Fore.LIGHTGREEN_EX + "[" + current_time + "] " + (ctx.author.name +"#"+ ctx.author.discriminator) + " Gave the Following Answer: " + answer)
await ctx.author.send("**`Your Answer Has Been Submitted, Please Be Patient As We Review!`**")
await ctx.author.send("Your Answer is: " + answer)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.