Skip to content

Commit

Permalink
fix(BaseGuildTextChannel): use async
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Aug 1, 2021
1 parent 716c71f commit a5604a5
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/structures/BaseGuildTextChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ class BaseGuildTextChannel extends GuildChannel {
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
* .catch(console.error);
*/
fetchWebhooks() {
return this.client.api.channels[this.id].webhooks.get().then(data => {
const hooks = new Collection();
for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));
return hooks;
});
async fetchWebhooks() {
const data = await this.client.api.channels[this.id].webhooks.get();
const hooks = new Collection();
for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));
return hooks;
}

/**
Expand Down Expand Up @@ -157,15 +156,14 @@ class BaseGuildTextChannel extends GuildChannel {
if (typeof avatar === 'string' && !avatar.startsWith('data:')) {
avatar = await DataResolver.resolveImage(avatar);
}
return this.client.api.channels[this.id].webhooks
.post({
data: {
name,
avatar,
},
reason,
})
.then(data => new Webhook(this.client, data));
const data = await this.client.api.channels[this.id].webhooks.post({
data: {
name,
avatar,
},
reason,
});
return new Webhook(this.client, data);
}

/**
Expand Down

0 comments on commit a5604a5

Please sign in to comment.