Discord.js命令冷却



我有一些代码,我不完全知道如何冷却它。它需要针对整个服务器,而不是针对个人用户id。

const Discord = require('discord.js');
module.exports = {
name: 'bump',
description: "This will bump the server",
execute(message, args){
const user = message.author;
var bumpEmbed = new Discord.MessageEmbed()
.setTitle('Time to Bump!')
.setColor(0xFF0000)
.setDescription('Please use the command `!d bump` to bump the server!!!')
message.channel.send(`Thanks ${user.username} for the bump!!`)
setTimeout(() => {
message.channel.send('**PLEASE DO NOT BUMP, UNLESS THE BUMP ROLES HAS BEEN MENTIONED!!**')
}, 1000)
setTimeout(() => {
message.channel.send('<@&821978298938425426>')
message.channel.send(bumpEmbed)
}, 7200000)
}
}

任何关于学习这一点的youtube视频都会有所帮助!

只需以discord.js指南中关于冷却的示例为例,将使用message.author.id的零件替换为message.guild.id,这应该可以在中工作

最新更新