如何像赠品机器人一样进行重新滚动命令?我设法制作了普通的赠品xD
这是我的代码:
if (command === "giveawaymake") {
let filter = (n) => n.author.id === message.author.id;
message.channel.send("Alright, so you wanna start a giveaway? `yes` or `no`");
message.channel
.awaitMessages(filter, { max: 1, time: 30000 })
.then(async (collected) => {
if (collected.first().content.toLowerCase() === "yes") {
await message.channel.send(
"Sweet!Now let's talk about the time, how long u will gonna host the giveaway?"
);
message.channel
.awaitMessages(filter, { max: 1, time: 30000 })
.then(async (collecter) => {
if (isNaN(collecter.first().content[0]) === false) {
if (
collecter.first().content.endsWith("d") &&
collecter.first().content.endsWith("h") &&
collecter.first().content.endsWith("m") &&
collecter.first().content.endsWith("s")
)
return message.reply(
"That is not the correct formatting time, canceling, please retart from the beginning!"
);
let drago = collecter.first().content;
await message.channel.send(
"Your time has been set, now what is the prize?"
);
message.channel
.awaitMessages(filter, { max: 1, time: 30000 })
.then(async (collectre) => {
if (collectre.first().content) {
let dragon = collectre.first().content;
await message.channel.send(
"Alright, your prize is not bad hehe :rofl:, now where you wanna put the giveaway?"
);
message.channel
.awaitMessages(filter, { max: 1, time: 30000 })
.then(async (collect) => {
if (collect.first().mentions.channels.first()) {
let channel = collect
.first()
.mentions.channels.first();
let time = ms(drago);
let realtime = prettyMS(time);
await message.channel.send("Giveaway Starts!");
let giveaway = new Discord.MessageEmbed()
.setTitle(`Giveaway Starts!`)
.setColor("BLUE").setDescription(`${drago}
${message.author} is hosting an giveaway
Duration: ${realtime}`);
let m = await channel.send(giveaway);
let link = m.url;
m.react("?");
setTimeout(() => {
if (m.reactions.cache.get("?").count - 1 <= 1)
return channel.channel.send(
"Rip, I can't decide the winner lmao"
);
let winner = m.reactions.cache
.get("?")
.users.cache.filter((u) => !u.bot)
.random();
channel.send(
`Congratulations! ${winner}! You won the ${dragon} \nThis is the message link! \n${link}`
);
}, ms(drago));
} else {
return message.reply(
"I cannot find that channel in this server, cancelling, please restart from the beginning!"
);
}
});
}
});
}
});
}
});
}
我可以执行该命令,但问题是获胜者何时以某种方式离开服务器?还是被afk?这就是为什么我要发出重新滚动命令,以便胜利者可以在短时间内重新滚动的原因,我一直在想这个xD的想法已经很久了