Python Discord.py模拟命令

Python Discord.py模拟命令,python,discord.py-rewrite,Python,Discord.py Rewrite,我在试着做一个模拟命令。就像用户可以输入“!mock hello you.”一样,机器人应该输出“hello you” 我没有计划怎么做也许你能帮我 @bot.command() async def mock(ctx, *, message): await ctx.send("Here should the bot send the mocked message") 使用random模块并假设您以正确的方式传递整个消息: @bot.comma

我在试着做一个模拟命令。就像用户可以输入“!mock hello you.”一样,机器人应该输出“hello you” 我没有计划怎么做也许你能帮我

    @bot.command()
    async def mock(ctx, *, message):
        await ctx.send("Here should the bot send the mocked message")

使用random模块并假设您以正确的方式传递整个消息:

@bot.command()
async def mock(ctx, *, message):
    out = ''.join(random.choice((str.upper, str.lower))(c) for c in message)
    await ctx.send(out)

到目前为止,您有任何工作代码吗?向我们展示您的尝试。您知道如何编写Discord bot命令吗?您知道如何接收输入文本并创建所需的输出文本吗?当你试图写代码时发生了什么?是的,我有一个开始。请稍等,我要编辑这封信谢谢,但这就像随机化大写字母一样,它应该像“这是一封模仿的邮件”而不是“这是一封模仿的邮件”,我希望你能修复它!谢谢你的帮助:DDDD