我有一些代码,但我不完全知道如何获得冷却时间。它需要针对整个服务器,而不是针对个人用户 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 视频都会有所帮助!
答案 0 :(得分:0)
只需使用 discord.js guide example on cooldowns 并将使用 message.author.id
的部分替换为 message.guild.id
就可以了