Skip to content

Commit

Permalink
fix: Fix race condition in Command#send
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzah committed Dec 17, 2020
1 parent 9ec09cc commit 0f79f2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CommandContext {
? util_1.formatAllowedMentions(options.allowedMentions, this.creator.allowedMentions)
: this.creator.allowedMentions;
if (!this.initiallyResponded) {
this.initiallyResponded = true;
await this._respond({
status: 200,
body: {
Expand All @@ -79,7 +80,6 @@ class CommandContext {
}
}
});
this.initiallyResponded = true;
return true;
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class CommandContext {
: this.creator.allowedMentions;

if (!this.initiallyResponded) {
this.initiallyResponded = true;
await this._respond({
status: 200,
body: {
Expand All @@ -146,7 +147,6 @@ class CommandContext {
}
}
});
this.initiallyResponded = true;
return true;
} else return this.sendFollowUp(content, options);
}
Expand Down

0 comments on commit 0f79f2d

Please sign in to comment.