【发布时间】:2021-06-16 20:42:52
【问题描述】:
我一直有一个问题,我一直试图弄清楚如何发送嵌入,然后让机器人对该嵌入做出反应,如果你对它做出反应,机器人将发布另一个类似这样的嵌入,
-代数, (机器人发送嵌入) (机器人对嵌入做出反应) (命令用户点击反应) (机器人发布另一个嵌入特定于反应)
我真的需要它有多个反应,比如十个,它会反应 1️⃣、2️⃣、3️⃣、4️⃣、5️⃣、6️⃣、7️⃣、8️⃣、9️⃣、??????
如果可能的话,我需要机器人来做这个
-代数 (嵌入机器人帖子) (机器人反应) (用户使用其中一个数字对嵌入做出反应) (机器人帖子嵌入与反应相对应) (机器人反应) (用户反应) (机器人发布了另一个与之对应的嵌入)
制作一条几乎无限的链。
module.exports = {
name: 'algebra',
description: 'This is a command that should help you with algebra',
async execute(message, args, Discord, client){
let ageEmbed = new Discord.MessageEmbed()
.setTitle('Algebra! Its pretty damn hard.')
.addField('So you are just starting off with Algebra and you want to learn the basics, Well no problem just react with 1️⃣')
.addField('So you want to know about the questions such as "*x* = 21+5, what is *x*?" well no problem just react with 2️⃣')
.setColor('#FF1493')
let msg = await message.channel.send(ageEmbed)
await msg.react('1️⃣');
await msg.react('2️⃣');
const filter_age = (reaction, user) => {
return reaction.emoji.name === '1️⃣' || '2️⃣' && user.id === message.author.id && !user.bot;
}
const collector_age = msg.createReactionCollector(filter_age, {
time: 30000,
max: 1
});
collector_age.on('collect', async (reaction, user) => {
if (reaction.emoji.name === '1️⃣') {
let justbegginingembed = new Discord.MessageEmbed()
.setDescription(`Just beggining with Algebra..`)
.addField("This is where just beggining with algebra will be");
message.channel.send(justbegginingembed)
} else {
collector_age.on('collect', async (reaction, user) => {
if (reaction.emoji.name === '2️⃣') {
let algebraembed2 = new Discord.MessageEmbed()
.setDescription('so you want to learn about ....')
.addField('THIS IS WHERE');
message.channel.send(algebraembed2)
}
})
}
})}}
它不起作用,我不明白如何解决它。该机器人有时甚至会发布两个嵌入内容。
谢谢。
【问题讨论】:
标签: node.js discord discord.js embed collectors