【问题标题】:Is there any way to embed a hyperlink in a RichEmbed?有没有办法在 RichEmbed 中嵌入超链接?
【发布时间】:2019-07-12 04:12:13
【问题描述】:

我正在尝试建立一个类似[this](https://stackoverflow.com/) 的链接,但我似乎找不到任何答案是否可行。

我已经尝试过 markdown 语法(如上所示),但似乎找不到任何其他答案。

这是我目前使用的代码:

message.author.send({
  embed: new Discord.RichEmbed()
    .setTitle("DiscordBot Help")
    .setColor("#42b6f4")
    .addField("help cosmetic - Cosmetic help.", "All cosmetic commands")
    .addField("help economy - Economy help.", "All economy commands")
    .addField("facts - Gives you facts", "Subcommands required")
    .addField("credits - Shows the developers", "All hail the Creators!")
    .addField("info - Fun info about DiscordBot", "10 fun facts.. or what?")
    .addField("patch - Shows current patch/updates.", "UPDATES ARE AWESOME!")
    // This is the line I'm having trouble with.
    .addField("Add DiscordBot to your server! [Click here](https://discordapp.com/oauth2/authorize?client_id=439778986050977792&scope=bot&permissions=8)", "Its mine now.")
    // Here the line ends.
    .addField("Enter prefix before the commands", "It wont work else ;)")
    .addField("MIT License | Copyright © 2018, Technotype", "All rights reserved.")
    .addField("More content coming soon!", "It'll just take time")
});

我希望代码的输出是这样的:

Add DiscordBot to your server! [Click here](https://discordapp.com/oauth2/authorize?client_id=439778986050977792&scope=bot&permissions=8)

但是我得到了输出:

Add DiscordBot to your server! \[Click here\]\(https://discordapp.com/oauth2/authorize?client_id=439778986050977792&scope=bot&permissions=8\)

【问题讨论】:

    标签: node.js discord discord.js


    【解决方案1】:

    字段名称不能包含链接,但字段值可以。
    所以这样的事情会起作用:

    .addField("Its mine now", "Add DiscordBot to your server! [Click here](https://discordapp.com/oauth2/authorize?client_id=439778986050977792&scope=bot&permissions=8)")
    

    【讨论】:

      猜你喜欢
      • 2019-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-20
      • 1970-01-01
      • 2019-11-23
      • 2018-07-03
      相关资源
      最近更新 更多