Python Discord bot不会在字符串中包含空格
我试着发出一个命令,机器人会复制我说的一切。但是机器人排除了空间后面的所有东西。 当我使用时!如果说aaa bbb,bot将只回复aaa,而不是aaa bbbPython Discord bot不会在字符串中包含空格,python,discord,discord.py,Python,Discord,Discord.py,我试着发出一个命令,机器人会复制我说的一切。但是机器人排除了空间后面的所有东西。 当我使用时!如果说aaa bbb,bot将只回复aaa,而不是aaa bbb @bot.command(name = 'say', help = 'make the bot say whatever you want') async def sayy(ctx, amount: str): if amount == ("!say"): deathThreat = rando
@bot.command(name = 'say', help = 'make the bot say whatever you want')
async def sayy(ctx, amount: str):
if amount == ("!say"):
deathThreat = random.choice(deathThreats)
await ctx.send(deathThreat)
else:
said = amount
await ctx.channel.purge(limit=1)
await ctx.send(said)
您必须在
金额
之前放置*
参数,以便金额
包含之后的所有内容!说
:
@bot.command(name='say',help='make the bot say any you want')
异步def sayy(ctx,*,金额:str):
如果金额==(“!say”):
死亡威胁=随机选择(死亡威胁)
等待ctx发送(死亡威胁)
其他:
所说的=金额
等待ctx通道净化(限值=1)
等待ctx发送(说)