我希望我的机器人将消息发送到聊天中,如下所示:
await ctx.send("This country is not supported, you can ask me to add it here")
但是要将“ here”变成可点击的链接,在HTML中,我会这样做,对吧?
<a href="https://www.youtube.com/" > This country is not supported, you can ask me to add it here </a>
如何在python中做到这一点?
答案 0 :(得分:1)
据我所知,Discord不允许在邮件中使用HTML,当您在某些邮件上看到任何格式的格式时,要么是:
问题在于这两种方法都无法帮助您解决问题,因为:
[[ 290 400 510]
[ 674 928 1182]
[1058 1456 1854]]
0.0
来实现所需的功能,但是在Discord上尝试使用它后,它似乎无法呈现,因此我猜测并不是所有的markdown都可以在Discord中使用答案 1 :(得分:1)
正如另一个答案所解释的那样,您不能在普通邮件中添加超链接,但是在“嵌入”中可以可以。我不明白为什么您不希望将Embed用于错误消息,特别是考虑到它添加了更多功能,因此您应该考虑使用它。
embed = discord.Embed()
embed.description = "This country is not supported, you can ask me to add it [here](your_link_goes_here)."
await ctx.send(embed=embed)
随意弄乱Embed并添加一些字段,标题,颜色以及您可能要做的其他任何使其看起来更好的事情。有关API docs的更多信息。
答案 2 :(得分:1)
还有另一种方法可以解决这个问题,您可以添加 url=(pop_in_link),当您这样做时,bot 这个工作正常,导入 discord。您可以使用任何一种方法