【发布时间】:2021-06-17 22:53:04
【问题描述】:
我有一些代码,但我不完全知道如何对其进行冷却。它需要针对整个服务器,而不是针对个人用户 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 视频都会有所帮助!
【问题讨论】:
-
我能找到的都是锁定到用户 ID 的视频,而且对我来说没有任何意义。
-
Discord.JS 有一个关于如何创建冷却时间的官方指南,View The Guide
-
锁定到用户 ID
-
然后使用服务器 ID。
标签: node.js discord.js