fix webhook

This commit is contained in:
Gus Caplan 2020-12-11 13:48:31 -06:00
parent 21bfe3da7c
commit db6d1b3ba9
No known key found for this signature in database
GPG key ID: F00BD11880E82F0E
2 changed files with 10 additions and 2 deletions

View file

@ -36,10 +36,15 @@ class InteractionClient extends BaseClient {
*/ */
constructor(options, handler, client) { constructor(options, handler, client) {
super(options); super(options);
this.client = client || this;
this.handler = handler; this.handler = handler;
this.token = options.token; this.token = options.token;
this.publicKey = options.publicKey ? Buffer.from(options.publicKey, 'hex') : undefined; this.publicKey = options.publicKey ? Buffer.from(options.publicKey, 'hex') : undefined;
this.clientId = options.clientId;
// Compat for direct usage
this.client = client || this;
this.interactionClient = this;
} }
getCommands(guildID) { getCommands(guildID) {

View file

@ -99,7 +99,10 @@ class Interaction extends Base {
const { data, files } = await apiMessage.resolveFiles(); const { data, files } = await apiMessage.resolveFiles();
return this.client.api.webhooks(this.id, this.token).post({ const clientId = this.client.interactionClient.clientId
|| (await this.client.api.oauth2.applications('@me').get()).id;
return this.client.api.webhooks(clientId, this.token).post({
auth: false, auth: false,
data, data,
files, files,