#Cooldown package

18 messages · Page 1 of 1 (latest)

drowsy oasisBOT
#
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by staff
steady pollen
#

Well, what do you want to do with it?

cinder heath
#

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 });}};

steady pollen
#

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

steady saddle
#

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

steady pollen
#

if you simply read the package it tells you everything

amber magnetBOT
cinder heath
steady saddle
#

if you have trouble, feel free to ask in the djs help channels

cinder heath
#

and the whole phone part

#

like what in the fuck is even that lol

steady saddle
#

that package is more complicated than it has to be. i suggest looking at the one from the guide

cinder heath
#

alright

#

thanks man