#Cooldown package
18 messages · Page 1 of 1 (latest)
Well, what do you want to do with it?
add a cooldown of an hour to my suggest.js command, every user can only use the command once an hour
this is my command const { SlashCommandBuilder, WebhookClient, EmbedBuilder } = require("discord.js"); const Cooldowns = require("@kamkam1_0/cooldown") let Cooldown = new Cooldowns() module.exports = { data: new SlashCommandBuilder() .setName("suggest") .setDescription("Make a suggestion for the server!") .addStringOption(option => option.setName("suggestion").setDescription("Your Suggetion").setRequired(true)), async execute(interaction) { const cooldownSeconds = 3600; const userId = interaction.user.id; const suggestion = interaction.options.getString("suggestion"); const username = interaction.user.username; const pfp = interaction.user.displayAvatarURL({ format: 'png', dynamic: true }); const webhook = new WebhookClient({ url: "https://discord.com/api/webhooks/1217502777027199026/G-1ZcLsDnzSquySXCB6jyq2RvbGk_5tbrfgS9H6FbPcl9d0hLEQwnnBwTR6AAE4AwUpP" }); const embed = new EmbedBuilder() .setTitle(`New suggestion by ${username}!`) .setDescription(`<@${userId}> - ${suggestion}`) .setColor("DarkPurple"); webhook.send({ content: ``, username: username, avatarURL: pfp, embeds: [embed],}); interaction.reply({ content: "All done!", ephemeral: true });}};
Okay, so if you read the docs on it you will see
do something like this
const Cooldowns = require("@kamkam1_0/cooldown")
let Cooldown = new Cooldowns()
and then cooldown.deploly(['cooldown')]
and then with the .adduser function, add an entry to that cooldown
actually, the discord.js guide has a cooldown section. using a package for this really isnt needed. also, please do not show your webhook url as that can risk the webhook from being compromised
if you simply read the package it tells you everything
Additional Features: Cooldowns
read more
I tried but i fucked up big time
if you have trouble, feel free to ask in the djs help channels
i didn't understand the adduser part, because it asks for the exact id, do i just make it get the id of the interaction.user.id ? but what if it adds it double
and the whole phone part
like what in the fuck is even that lol
that package is more complicated than it has to be. i suggest looking at the one from the guide
alright
thanks man