如何让不和谐机器人在多行上打印一条消息?

时间:2021-06-02 13:25:47

标签: python discord discord.py

我希望我的机器人发送多行而不是每次都发送一条新消息。以下是它目前的输出。我突出显示了文本以表明“不常见:”是一个与其他信息不同的单独信息。 https://cdn.discordapp.com/attachments/529146682882129921/849638127785345044/Untitled-1.png

这就是我想要它输出的内容,它是多行但都在一条消息上。 https://cdn.discordapp.com/attachments/529146682882129921/849638125205848104/Untitled-2.png

我正在使用 python 和 discord.py 对此进行编码。变量保存在列表中,标题为 hornonhorn,代码从中获取多个值并生成一个随机值。

        if message.content.startswith('!gen uncommon'):
            await message.channel.send("Uncommon:")
            await message.channel.send("> Horn: " + random.choice(random.choice(horn[0:2])))
            await message.channel.send("> On horn trait: " + random.choice(random.choice(onhorn[0:2])))

1 个答案:

答案 0 :(得分:1)

只需使用换行符 (const onRegister)

\n