Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.

Commit d9833a4

Browse files
authored
fix: cannot read property 'timer' of undefined in cooldowns (discord-akairo#142)
1 parent b57bf93 commit d9833a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/struct/commands/CommandHandler.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,9 @@ class CommandHandler extends AkairoHandler {
723723
if (!this.cooldowns.get(id)[command.id]) {
724724
this.cooldowns.get(id)[command.id] = {
725725
timer: this.client.setTimeout(() => {
726-
this.client.clearTimeout(this.cooldowns.get(id)[command.id].timer);
726+
if (this.cooldowns.get(id)[command.id]) {
727+
this.client.clearTimeout(this.cooldowns.get(id)[command.id].timer);
728+
}
727729
this.cooldowns.get(id)[command.id] = null;
728730

729731
if (!Object.keys(this.cooldowns.get(id)).length) {

0 commit comments

Comments
 (0)