【发布时间】:2021-10-13 08:23:27
【问题描述】:
你好,所以我写了这段代码
module.exports.run = async (Client, message, args, prefix) => {
if (!message.content.startsWith(prefix)) return;
disbut(Client);
let button1 = new disbut.MessageButton()
.setStyle("green") //default: blurple
.setLabel("créer un channel") //default: NO_LABEL_PROVIDED
.setID("create"); //note: if you use the style "url" you must provide url using .setURL('https://example.com')
let button2 = new disbut.MessageButton()
.setStyle("red") //default: blurple
.setLabel("fermer un channel") //default: NO_LABEL_PROVIDED
.setID("close"); //note: if you use the style "url" you must provide url using .setURL('https://example.com')
message.channel.send("Cliquer sur les boutons pour effectuer une action ", {buttons : [button1, button2] });
};
如果我执行我的命令,文本会在我的频道中发送,而不是按钮 我不明白为什么,我没有任何错误
感谢您的帮助:)
【问题讨论】:
-
我在文档中找到了添加多个按钮的方法:
let row = new MessageActionRow().addComponents(button, button2);。然后发送带有消息的按钮send('msg', row)。试一试。 -
而您返回的内容没有前缀 2 次。这样做的目的是什么?
-
感谢您的回答,我会尽快尝试对于您的问题,我只是想念我的 ctrl-c ctrl-v 错误。
-
我的问题是不添加多个按钮,我不能在我的消息上只添加一个按钮
标签: javascript node.js discord.js discord-buttons