[英]Discord.js Button Links
Hello I am trying to use a discord.js button to link to a website您好,我正在尝试使用 discord.js 按钮链接到网站
This is what I attempted to do这就是我试图做的
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('whatever')
.setLabel('CLICK THIS')
.setLink("google.com")
.setStyle('LINK'),
);
However this does not work due to set link not being a function但是这不起作用,因为设置链接不是 function
And the documentation doesnt help me out with this文档并没有帮助我解决这个问题
Conor Reid is right康纳里德是对的
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setLabel('CLICK THIS')
.setURL("urlhere")
.setStyle('LINK'),
);
The correct function is setUrl()正确的 function 是 setUrl()
MessageButton.setLink()
is not a function. Although I can see why this may be confusing because of the setStyle('LINK')
being required. MessageButton.setLink()
不是 function。虽然我明白为什么这可能会令人困惑,因为需要setStyle('LINK')
。 The correct function is .setURL(url)
.正确的 function 是.setURL(url)
。 The MessageButton documentation is available here https://discord.js.org/#/docs/main/stable/class/MessageButton MessageButton 文档可在此处 获得 https://discord.js.org/#/docs/main/stable/class/MessageButton
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.