From 11fcbdcad2875aa6a54f89df6cd0c4f850f3866f Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Wed, 17 Jan 2024 06:33:06 +1100 Subject: [PATCH] Remove unneeded param from fetchers --- src/components/HookManager.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/HookManager.ts b/src/components/HookManager.ts index b64f27c..967552c 100644 --- a/src/components/HookManager.ts +++ b/src/components/HookManager.ts @@ -14,18 +14,18 @@ export default class HookMgr { this.webhookId = webhookId; } - protected channelFetch = async(client:TClient, channel:ChannelList)=>await client.channels.fetch(config.dcServer.channels[channel]) as Discord.TextChannel; - protected async fetch(client:TClient, channel:ChannelList, webhookId:Discord.Snowflake) { - const hookInstance = await (await this.channelFetch(client, channel)).fetchWebhooks().then(x=>x.find(y=>y.id===webhookId)); + protected channelFetch = async(channel:ChannelList)=>await this.client.channels.fetch(config.dcServer.channels[channel]) as Discord.TextChannel; + protected async fetch(channel:ChannelList, webhookId:Discord.Snowflake) { + const hookInstance = await (await this.channelFetch(channel)).fetchWebhooks().then(x=>x.find(y=>y.id===webhookId)); if (!hookInstance) throw new Error('[HookManager] Webhook not found.'); return hookInstance; } async send(message:string|Discord.MessagePayload|Discord.WebhookMessageCreateOptions) { - const hook = await this.fetch(this.client, this.channel, this.webhookId); + const hook = await this.fetch(this.channel, this.webhookId); return hook.send(message).catch(err=>(this.client.channels.resolve(config.dcServer.channels.errors) as Discord.TextChannel).send(`Failed to send a webhook message in #${this.channel}:\n\`\`\`\n${err.message}\n\`\`\``)); } async edit(messageId:Discord.Snowflake, message:string|Discord.MessagePayload|Discord.WebhookMessageEditOptions) { - const hook = await this.fetch(this.client, this.channel, this.webhookId); + const hook = await this.fetch(this.channel, this.webhookId); return hook.editMessage(messageId, message).catch(err=>(this.client.channels.resolve(config.dcServer.channels.errors) as Discord.TextChannel).send(`Failed to edit a webhook message in #${this.channel}:\n\`\`\`\n${err.message}\n\`\`\``)); } }