Slash Commands Cooldowns

Hi, I just followed the guide for the cooldown but I get errors.
21 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Mardroide
Mardroide12mo ago
TypeError: Cannot read properties of undefined (reading 'ws')
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\commands\fun\ping.js:10:83)
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\events\content\interactionCreate.js:17:21)
at Client.<anonymous> (C:\Users\Marcos\Documents\Work\plasmify\app\src\helpers\deploy-events.js:17:50)
at Client.emit (node:events:511:28)
at InteractionCreateAction.handle (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketShard.js:494:22)
at WebSocketShard.onMessage (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
at callListener (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\ws\lib\event-target.js:290:14)
node:events:489
throw er; // Unhandled 'error' event
^

TypeError: Cannot destructure property 'cooldowns' of 'client' as it is undefined.
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\events\content\interactionCreate.js:34:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v20.3.0
TypeError: Cannot read properties of undefined (reading 'ws')
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\commands\fun\ping.js:10:83)
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\events\content\interactionCreate.js:17:21)
at Client.<anonymous> (C:\Users\Marcos\Documents\Work\plasmify\app\src\helpers\deploy-events.js:17:50)
at Client.emit (node:events:511:28)
at InteractionCreateAction.handle (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketManager.js:352:31)
at WebSocketShard.onPacket (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketShard.js:494:22)
at WebSocketShard.onMessage (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\discord.js\src\client\websocket\WebSocketShard.js:328:10)
at callListener (C:\Users\Marcos\Documents\Work\plasmify\app\node_modules\ws\lib\event-target.js:290:14)
node:events:489
throw er; // Unhandled 'error' event
^

TypeError: Cannot destructure property 'cooldowns' of 'client' as it is undefined.
at Object.execute (C:\Users\Marcos\Documents\Work\plasmify\app\src\events\content\interactionCreate.js:34:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v20.3.0
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
1 sec
Mardroide
Mardroide12mo ago
SourceBin
InteractionCreate
Instantly share your code with the world.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
at the index
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
I have this command.execute(interaction, client)
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
im passing it let me check
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
SourceBin
Event Handler
Instantly share your code with the world.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Mardroide
Mardroide12mo ago
You mean like this?
Mardroide
Mardroide12mo ago
SourceBin
1.0
Instantly share your code with the world.
Mardroide
Mardroide12mo ago
okey yeah but thge cooldowns doesn't work idk why xd
d.js docs
d.js docs12mo ago
To help you we need more information: - What are you trying to do? - What is your code? - What errors and debug logs do you have?
Mardroide
Mardroide12mo ago
yeah okey let me explain I just done the changes you told me sir, but the cooldowns doesn't tkae effect. I mean, by following the steps at the guide and the corrections still doesn't work
Mardroide
Mardroide12mo ago
SourceBin
Last code Handler
Instantly share your code with the world.
Mardroide
Mardroide12mo ago
so I switch the checks thanks Still doesn't get it I moved the check upper to return if the user is at a cooldown and still doesn't work