我一直在使用JS为我的服务器创建一个简单的不和谐机器人。我一直试图让它发送一条包含服务器规则的消息。当运行/rules命令时,我会收到一个通知来声明已经发送了一条消息,但是在任何设备上都看不到消息。我能够查看消息历史,所以我不明白为什么没有可见的嵌入或消息。
我的代码是使用Autocode的不和谐嵌入生成器制作的,并且在同一个Bot中为其他嵌入器工作过。在Builder中查看完整嵌入代码并查看其外观的链接是这里。
发布于 2022-03-04 22:28:45
学习自己制作这些代码要比使用生成器并试图反向设计它们的编码方式要容易得多:
一个简单的例子是:
const {
MessageEmbed
} = require('discord.js')
module.exports = {
name: "rules",
description: "Post rules",
run: async (client, interaction) => {
// build the message
const embed = new MessageEmbed()
.setColor('#00ff00') //change the color if you want
.setTitle('Some Title')
.setDescription(`Some description`)
.addFields({
name: 'Rule Name/Number',
value: 'Rule text',
inline: true
}, {
name: 'Rule Name/Number',
value: `Rule text`,
inline: true
}, {
name: 'Rule Name/Number',
value: 'Rule text',
inline: true
})
// add more if needed
// send the message
interaction.channel.send({
embeds: [embed]
})
// confirm they are sent and complete the interaction only visible to you
return interaction.reply({
content: 'Done',
ephemeral: true
})
}
}https://stackoverflow.com/questions/71346081
复制相似问题