fix: avoid sending bot auth on token endpoints (#7022)

This commit is contained in:
SpaceEEC
2021-11-23 10:28:09 +01:00
committed by GitHub
parent 099536ee60
commit 7efeff461f
3 changed files with 10 additions and 1 deletions

View File

@@ -99,6 +99,7 @@ class AutocompleteInteraction extends Interaction {
choices: options, choices: options,
}, },
}, },
auth: false,
}); });
this.responded = true; this.responded = true;
} }

View File

@@ -249,6 +249,7 @@ class Webhook {
const data = await this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({ const data = await this.client.api.webhooks(this.id, channel ? undefined : this.token).patch({
data: { name, avatar, channel_id: channel }, data: { name, avatar, channel_id: channel },
reason, reason,
auth: !this.token || Boolean(channel),
}); });
this.name = data.name; this.name = data.name;
@@ -287,6 +288,7 @@ class Webhook {
query: { query: {
thread_id: cacheOrOptions.threadId, thread_id: cacheOrOptions.threadId,
}, },
auth: false,
}); });
return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data; return this.client.channels?.cache.get(data.channel_id)?.messages._add(data, cacheOrOptions.cache) ?? data;
} }
@@ -317,6 +319,7 @@ class Webhook {
query: { query: {
thread_id: messagePayload.options.threadId, thread_id: messagePayload.options.threadId,
}, },
auth: false,
}); });
const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages; const messageManager = this.client.channels?.cache.get(d.channel_id)?.messages;
@@ -336,7 +339,7 @@ class Webhook {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
async delete(reason) { 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 });
} }
/** /**
@@ -355,6 +358,7 @@ class Webhook {
query: { query: {
thread_id: threadId, thread_id: threadId,
}, },
auth: false,
}); });
} }

View File

@@ -61,6 +61,7 @@ class InteractionResponses {
flags: options.ephemeral ? MessageFlags.FLAGS.EPHEMERAL : undefined, flags: options.ephemeral ? MessageFlags.FLAGS.EPHEMERAL : undefined,
}, },
}, },
auth: false,
}); });
this.deferred = true; this.deferred = true;
@@ -101,6 +102,7 @@ class InteractionResponses {
data, data,
}, },
files, files,
auth: false,
}); });
this.replied = true; this.replied = true;
@@ -179,6 +181,7 @@ class InteractionResponses {
data: { data: {
type: InteractionResponseTypes.DEFERRED_MESSAGE_UPDATE, type: InteractionResponseTypes.DEFERRED_MESSAGE_UPDATE,
}, },
auth: false,
}); });
this.deferred = true; this.deferred = true;
@@ -213,6 +216,7 @@ class InteractionResponses {
data, data,
}, },
files, files,
auth: false,
}); });
this.replied = true; this.replied = true;