【问题标题】:Using 2 Titles in an embed in Discord.py在 Discord.py 的嵌入中使用 2 个标题
【发布时间】:2021-11-21 10:03:51
【问题描述】:

我正在为我的服务器制作一个不和谐的机器人,我想在用户投票时发送 2 个链接。

client = discord.Client()

@client.event
async def on_message(message):

if message.content.startswith (']svote') :
    await message.add_reaction (doubleupemote)
    embed=discord.Embed(title="Vote the Server", url="https://top.gg/servers/876028384042426368/vote", color=0x00fa11)
    await message.channel.send(embed=embed)

在这里,它发送一个带有 Vote The Server 的嵌入。有什么方法可以为同一个嵌入添加另一个标题吗?

或任何替代方式发送

为机器人投票

投票给服务器

我想在这 2 个句子中插入 2 个链接。

【问题讨论】:

  • 我不知道你为什么投反对票 :(

标签: duplicates discord.py embed title


【解决方案1】:

没有办法在一个嵌入中包含“两个标题”。您可以使用 \n 在标题中创建一个新行,但您将无法发布第二个链接/标题只会链接到一个 URL。

但是,您可以创建 description 或添加 field

请查看以下示例代码以获取说明:

if message.content.startswith (']svote') :
    await message.add_reaction (doubleupemote)
    embed = discord.Embed(color=0x00fa11)
    embed.title = "Links to vote"
    embed.description = "**[Vote for the bot](https://top.gg/) \n [Vote for the server](https://top.gg/)**"
    await message.channel.send(embed=embed)

输出:

如果你想把它放在标题中,你可以使用我提到的方法,但它不会是相同的输出。

应该有效的标题代码:

embed = discord.Embed(color=0x00fa11)
embed.title = "Vote for the bot: https://top.gg/ \nVote for the server: https://top.gg/"

输出:

【讨论】:

    猜你喜欢
    • 2021-06-18
    • 2021-04-09
    • 2020-08-28
    • 1970-01-01
    • 2021-01-01
    • 2021-02-21
    • 1970-01-01
    • 2021-12-20
    • 2020-04-21
    相关资源
    最近更新 更多