Skip to content

Commit

Permalink
fix: avoid sending bot auth on token endpoints (#7022)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC committed Nov 23, 2021
1 parent 099536e commit 7efeff4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/structures/AutocompleteInteraction.js
Expand Up @@ -99,6 +99,7 @@ class AutocompleteInteraction extends Interaction {
choices: options,
},
},
auth: false,
});
this.responded = true;
}
Expand Down
6 changes: 5 additions & 1 deletion src/structures/Webhook.js
Expand Up @@ -249,6 +249,7 @@ class Webhook {
const data = await this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({
data: { name, avatar, channel_id: channel },
reason,
auth: !this.token || Boolean(channel),
});

this.name = data.name;
Expand Down Expand Up @@ -287,6 +288,7 @@ class Webhook {
query: {
thread_id: cacheOrOptions.threadId,
},
auth: false,
});
return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data;
}
Expand Down Expand Up @@ -317,6 +319,7 @@ class Webhook {
query: {
thread_id: messagePayload.options.threadId,
},
auth: false,
});

const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages;
Expand All @@ -336,7 +339,7 @@ class Webhook {
* @returns {Promise<void>}
*/
async delete(reason) {
await this.client.api.webhooks(this.id, this.token).delete({ reason });
await this.client.api.webhooks(this.id, this.token).delete({ reason, auth: !this.token });
}

/**
Expand All @@ -355,6 +358,7 @@ class Webhook {
query: {
thread_id: threadId,
},
auth: false,
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/structures/interfaces/InteractionResponses.js
Expand Up @@ -61,6 +61,7 @@ class InteractionResponses {
flags: options.ephemeral ? MessageFlags.FLAGS.EPHEMERAL : undefined,
},
},
auth: false,
});
this.deferred = true;

Expand Down Expand Up @@ -101,6 +102,7 @@ class InteractionResponses {
data,
},
files,
auth: false,
});
this.replied = true;

Expand Down Expand Up @@ -179,6 +181,7 @@ class InteractionResponses {
data: {
type: InteractionResponseTypes.DEFERRED_MESSAGE_UPDATE,
},
auth: false,
});
this.deferred = true;

Expand Down Expand Up @@ -213,6 +216,7 @@ class InteractionResponses {
data,
},
files,
auth: false,
});
this.replied = true;

Expand Down

0 comments on commit 7efeff4

Please sign in to comment.