From 5a0963be43c9e9b6f6d16be5444ab7f2a53de016 Mon Sep 17 00:00:00 2001 From: mezotv Date: Wed, 6 Nov 2024 02:16:32 +0000 Subject: [PATCH] chore(style): format files --- src/buttons/replayFunctions/replayDelete.ts | 53 +-- src/buttons/replayFunctions/replayType.ts | 51 +-- src/util/Functions/jsonImport.ts | 380 +++++++++++--------- src/util/keepAlive.ts | 2 +- src/util/webhookHandler.ts | 40 +-- 5 files changed, 280 insertions(+), 246 deletions(-) diff --git a/src/buttons/replayFunctions/replayDelete.ts b/src/buttons/replayFunctions/replayDelete.ts index 1756fd59..c91114ac 100644 --- a/src/buttons/replayFunctions/replayDelete.ts +++ b/src/buttons/replayFunctions/replayDelete.ts @@ -13,31 +13,34 @@ const button: Button = { execute: async (interaction, client, guildDb) => { const arr = guildDb.replayChannels.filter( - (c) => c.id !== (interaction as any).values[0] + (c) => c.id !== (interaction as any).values[0], ).length > 0 ? guildDb.replayChannels : "None"; const generalMsg = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.generalTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.generalTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.replayType" + "Settings.embed.replayType", )}: ${guildDb.replayType}\n${client.translation.get( guildDb?.language, - "Settings.embed.replayBy" + "Settings.embed.replayBy", )}: ${guildDb.replayBy}\n${ guildDb.replayBy === "Guild" ? client.translation.get( guildDb?.language, - "Settings.embed.replayBy2" + "Settings.embed.replayBy2", ) : client.translation.get( guildDb?.language, - "Settings.embed.replayBy1" + "Settings.embed.replayBy1", ) }\n${client.translation.get(guildDb?.language, "Settings.embed.replayChannels")}: ${ arr === "None" @@ -47,13 +50,13 @@ const button: Button = { .filter((c) => c.id !== (interaction as any).values[0]) .map((c) => `<#${c.id}>: ${Number(c.cooldown) / 1000}s`) .join("\n")}` - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -65,8 +68,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayType" - ) + "Settings.button.replayType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1207774450658050069"), @@ -75,11 +78,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayBy" - ) + "Settings.button.replayBy", + ), ) .setStyle(ButtonStyle.Primary) - .setEmoji("1207778786976989244") + .setEmoji("1207778786976989244"), ); let setDeleteButtons: ActionRowBuilder; @@ -90,19 +93,19 @@ const button: Button = { .setCustomId( guildDb.replayType === "Channels" ? "replayChannels" - : "replayCooldown" + : "replayCooldown", ) .setEmoji("1185973661736374405") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayCooldown" - ) + "Settings.button.replayCooldown", + ), ) .setStyle( guildDb.replayCooldown ? ButtonStyle.Success - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("replayDeleteChannels") @@ -110,10 +113,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayDeleteChannels" - ) + "Settings.button.replayDeleteChannels", + ), ) - .setStyle(ButtonStyle.Danger) + .setStyle(ButtonStyle.Danger), ); } else { setDeleteButtons = @@ -124,19 +127,19 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayCooldown" - ) + "Settings.button.replayCooldown", + ), ) .setStyle( guildDb.replayCooldown ? ButtonStyle.Success - : ButtonStyle.Secondary - ) + : ButtonStyle.Secondary, + ), ); } guildDb.replayChannels = guildDb.replayChannels.filter( - (c) => c.id !== (interaction as any).values[0] + (c) => c.id !== (interaction as any).values[0], ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/replayFunctions/replayType.ts b/src/buttons/replayFunctions/replayType.ts index 98309818..e114e353 100644 --- a/src/buttons/replayFunctions/replayType.ts +++ b/src/buttons/replayFunctions/replayType.ts @@ -14,49 +14,52 @@ const button: Button = { const newType = guildDb.replayType === "Channels" ? "Guild" : "Channels"; const generalMsg = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.generalTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.generalTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.replayType" + "Settings.embed.replayType", )}: ${newType}\n${client.translation.get(guildDb?.language, "Settings.embed.replayBy")}: ${guildDb.replayBy}\n${ guildDb.replayBy === "Guild" ? client.translation.get( guildDb?.language, - "Settings.embed.replayBy2" + "Settings.embed.replayBy2", ) : client.translation.get( guildDb?.language, - "Settings.embed.replayBy1" + "Settings.embed.replayBy1", ) }\n${ guildDb.replayType === "Channels" ? `${client.translation.get( guildDb?.language, - "Settings.embed.replayCooldown" + "Settings.embed.replayCooldown", )}: ${guildDb.replayCooldown / 1000}s` : `${client.translation.get(guildDb?.language, "Settings.embed.replayChannels")}: ${ guildDb.replayChannels.length > 0 ? `\n${guildDb.replayChannels .sort( (a: any, b: any) => - b.cooldown / 1000 - a.cooldown / 1000 + b.cooldown / 1000 - a.cooldown / 1000, ) .map((c) => `<#${c.id}>: ${Number(c.cooldown) / 1000}s`) .join("\n")}` : client.translation.get( guildDb?.language, - "Settings.embed.replayChannelsNone" + "Settings.embed.replayChannelsNone", ) }` - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -68,8 +71,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayType" - ) + "Settings.button.replayType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1207774450658050069"), @@ -78,11 +81,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayBy" - ) + "Settings.button.replayBy", + ), ) .setStyle(ButtonStyle.Primary) - .setEmoji("1207778786976989244") + .setEmoji("1207778786976989244"), ); let setDeleteButtons: ActionRowBuilder; @@ -95,13 +98,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayCooldown" - ) + "Settings.button.replayCooldown", + ), ) .setStyle( guildDb.replayCooldown ? ButtonStyle.Success - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("replayDeleteChannels") @@ -109,10 +112,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayDeleteChannels" - ) + "Settings.button.replayDeleteChannels", + ), ) - .setStyle(ButtonStyle.Danger) + .setStyle(ButtonStyle.Danger), ); } else { setDeleteButtons = @@ -123,14 +126,14 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.replayCooldown" - ) + "Settings.button.replayCooldown", + ), ) .setStyle( guildDb.replayCooldown ? ButtonStyle.Success - : ButtonStyle.Secondary - ) + : ButtonStyle.Secondary, + ), ); } await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index 8c300c95..4055c87e 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -1,85 +1,98 @@ import path from "node:path"; import { GuildModel, type IGuildModel } from "../Models/guildModel"; -import { dareModel, nhieModel, topicModel, truthModel, wwydModel, wyrModel } from "../Models/questionModel"; +import { + dareModel, + nhieModel, + topicModel, + truthModel, + wwydModel, + wyrModel, +} from "../Models/questionModel"; import { usedQuestionModel } from "../Models/usedModel"; interface LanguageMapInterface { - [key: string]: string; + [key: string]: string; } const languageMap: LanguageMapInterface = { - en_EN: "en", - es_ES: "es", - de_DE: "de", - it_IT: "it", + en_EN: "en", + es_ES: "es", + de_DE: "de", + it_IT: "it", }; import type { UpdateWriteOpResult } from "mongoose"; import shuffle from "../shuffle"; export interface QuestionResult { - id: string; - question: string; + id: string; + question: string; } -type Quest = "truthQuestions" | "dareQuestions" | "wwydQuestions" | "nhieQuestions" | "wyrQuestions" | "topicQuestions"; +type Quest = + | "truthQuestions" + | "dareQuestions" + | "wwydQuestions" + | "nhieQuestions" + | "wyrQuestions" + | "topicQuestions"; const validTypes = [ - "wouldyourather", - "customwouldyourather", - "neverhaveiever", - "customneverhaveiever", - "truth", - "customtruth", - "dare", - "customdare", - "whatwouldyoudo", - "customwhatwouldyoudo", - "topic", - "customtopic", + "wouldyourather", + "customwouldyourather", + "neverhaveiever", + "customneverhaveiever", + "truth", + "customtruth", + "dare", + "customdare", + "whatwouldyoudo", + "customwhatwouldyoudo", + "topic", + "customtopic", ]; interface IUsedQuestions { - wyrQuestions: string[]; - customWyrQuestions: string[]; - nhieQuestions: string[]; - customNhieQuestions: string[]; - truthQuestions: string[]; - customTruthQuestions: string[]; - dareQuestions: string[]; - customDareQuestions: string[]; - wwydQuestions: string[]; - customWwydQuestions: string[]; - topicQuestions: string[]; - customTopicQuestions: string[]; + wyrQuestions: string[]; + customWyrQuestions: string[]; + nhieQuestions: string[]; + customNhieQuestions: string[]; + truthQuestions: string[]; + customTruthQuestions: string[]; + dareQuestions: string[]; + customDareQuestions: string[]; + wwydQuestions: string[]; + customWwydQuestions: string[]; + topicQuestions: string[]; + customTopicQuestions: string[]; } const typeCheck: { [key: string]: keyof IUsedQuestions } = { - wouldyourather: "wyrQuestions", - customwouldyourather: "customWyrQuestions", - neverhaveiever: "nhieQuestions", - customneverhaveiever: "customNhieQuestions", - truth: "truthQuestions", - customtruth: "customTruthQuestions", - dare: "dareQuestions", - customdare: "customDareQuestions", - whatwouldyoudo: "wwydQuestions", - customwhatwouldyoudo: "customWwydQuestions", - topic: "topicQuestions", - customtopic: "customTopicQuestions", + wouldyourather: "wyrQuestions", + customwouldyourather: "customWyrQuestions", + neverhaveiever: "nhieQuestions", + customneverhaveiever: "customNhieQuestions", + truth: "truthQuestions", + customtruth: "customTruthQuestions", + dare: "dareQuestions", + customdare: "customDareQuestions", + whatwouldyoudo: "wwydQuestions", + customwhatwouldyoudo: "customWwydQuestions", + topic: "topicQuestions", + customtopic: "customTopicQuestions", }; function getPath(file: string) { - const fullPath = path.join(__dirname, "..", "..", "data", file); - return fullPath; + const fullPath = path.join(__dirname, "..", "..", "data", file); + return fullPath; } export async function getHigherLower(): Promise { - let result = [] as any[]; - await import(getPath("hl-en_EN.json")).then((value) => { - result = value.data; - }); - return result; + let result = [] as any[]; + await import(getPath("hl-en_EN.json")).then((value) => { + result = value.data; + }); + return result; } export async function getRandomTod( @@ -106,7 +119,7 @@ export async function getRandomTod( enabled, ); - return Math.random() < 0.5 ? truth : dare; + return Math.random() < 0.5 ? truth : dare; } export async function getQuestionsByType( @@ -117,95 +130,108 @@ export async function getQuestionsByType( premium: boolean, enabled = true, ): Promise { - if (!validTypes.includes(type)) { - return Promise.reject("Invalid type"); - } - - const normalizedLanguage = languageMap[language] || "en"; - - const models: { [key: string]: any } = { - wouldyourather: wyrModel, - neverhaveiever: nhieModel, - truth: truthModel, - dare: dareModel, - whatwouldyoudo: wwydModel, - topic: topicModel, - }; - - let selectedModel = models[type.toLowerCase()]; - - let result: QuestionResult = { id: "", question: "" }; - - if (guildDb != null) { - if (guildDb.customTypes !== "regular" && guildDb.customMessages.filter((e) => e.type === type).length === 0) - guildDb.customTypes = "regular"; - - let usedQuestions = await usedQuestionModel.find({ - guildID: guildDb.guildID, - }); - - if (!usedQuestions[0] && premium && enabled) { - await usedQuestionModel.create({ - guildID: guildDb.guildID, - customTruthQuestions: [], - truthQuestions: [], - customDareQuestions: [], - dareQuestions: [], - customNhieQuestions: [], - nhieQuestions: [], - wwydQuestions: [], - customWwydQuestions: [], - wyrQuestions: [], - customWyrQuestions: [], - }); - - usedQuestions = await usedQuestionModel.find({ - guildID: guildDb.guildID, - }); - } - - async function getDBQuestion(nin: string[]) { - return await selectedModel.aggregate([{ $match: { id: { $nin: nin } } }, { $sample: { size: 1 } }]); - } - - let questionDatabase = await getDBQuestion(premium && enabled ? usedQuestions[0][typeCheck[type]] : []); - - if (!questionDatabase[0]?.id && premium && enabled) { - await reset(type as Quest, guildDb.customTypes, guildDb.guildID, "db"); - questionDatabase = await getDBQuestion([]); - } - - async function getRandomCustom(nin: string[]) { - return await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.id": { - $nin: nin, - }, - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { $sample: { size: 1 } }, - { - $project: { - id: "$customMessages.id", - question: "$customMessages.question", - type: "$customMessages.type", - }, - }, - ]); - } - - let newRandomCustomQuestion = await getRandomCustom( - premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [], - ); - - if (!newRandomCustomQuestion[0]?.id && premium && enabled) { - await reset(type as Quest, guildDb.customTypes, guildDb.guildID, "custom"); - newRandomCustomQuestion = await getRandomCustom([]); - } + if (!validTypes.includes(type)) { + return Promise.reject("Invalid type"); + } + + const normalizedLanguage = languageMap[language] || "en"; + + const models: { [key: string]: any } = { + wouldyourather: wyrModel, + neverhaveiever: nhieModel, + truth: truthModel, + dare: dareModel, + whatwouldyoudo: wwydModel, + topic: topicModel, + }; + + let selectedModel = models[type.toLowerCase()]; + + let result: QuestionResult = { id: "", question: "" }; + + if (guildDb != null) { + if ( + guildDb.customTypes !== "regular" && + guildDb.customMessages.filter((e) => e.type === type).length === 0 + ) + guildDb.customTypes = "regular"; + + let usedQuestions = await usedQuestionModel.find({ + guildID: guildDb.guildID, + }); + + if (!usedQuestions[0] && premium && enabled) { + await usedQuestionModel.create({ + guildID: guildDb.guildID, + customTruthQuestions: [], + truthQuestions: [], + customDareQuestions: [], + dareQuestions: [], + customNhieQuestions: [], + nhieQuestions: [], + wwydQuestions: [], + customWwydQuestions: [], + wyrQuestions: [], + customWyrQuestions: [], + }); + + usedQuestions = await usedQuestionModel.find({ + guildID: guildDb.guildID, + }); + } + + async function getDBQuestion(nin: string[]) { + return await selectedModel.aggregate([ + { $match: { id: { $nin: nin } } }, + { $sample: { size: 1 } }, + ]); + } + + let questionDatabase = await getDBQuestion( + premium && enabled ? usedQuestions[0][typeCheck[type]] : [], + ); + + if (!questionDatabase[0]?.id && premium && enabled) { + await reset(type as Quest, guildDb.customTypes, guildDb.guildID, "db"); + questionDatabase = await getDBQuestion([]); + } + + async function getRandomCustom(nin: string[]) { + return await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.id": { + $nin: nin, + }, + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { $sample: { size: 1 } }, + { + $project: { + id: "$customMessages.id", + question: "$customMessages.question", + type: "$customMessages.type", + }, + }, + ]); + } + + let newRandomCustomQuestion = await getRandomCustom( + premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [], + ); + + if (!newRandomCustomQuestion[0]?.id && premium && enabled) { + await reset( + type as Quest, + guildDb.customTypes, + guildDb.guildID, + "custom", + ); + newRandomCustomQuestion = await getRandomCustom([]); + } let types = guildDb.channelTypes.find((e) => e.channelId === channel)?.questionType || @@ -225,9 +251,11 @@ export async function getQuestionsByType( : questionDatabase[0].translations[normalizedLanguage], }; - break; - case "mixed": { - const mixedQuestions = shuffle([...questionDatabase.concat(newRandomCustomQuestion[0])]); + break; + case "mixed": { + const mixedQuestions = shuffle([ + ...questionDatabase.concat(newRandomCustomQuestion[0]), + ]); result = { id: mixedQuestions[0] ? mixedQuestions[0]?.id : mixedQuestions[1]?.id, @@ -271,40 +299,40 @@ export async function getQuestionsByType( { $sample: { size: 1 } }, ]); - result = { - id: questionDatabase[0].id, - question: - normalizedLanguage === "en" - ? questionDatabase[0].question - : questionDatabase[0].translations[normalizedLanguage], - }; - } + result = { + id: questionDatabase[0].id, + question: + normalizedLanguage === "en" + ? questionDatabase[0].question + : questionDatabase[0].translations[normalizedLanguage], + }; + } - return result as QuestionResult; + return result as QuestionResult; } export async function reset( - type: Quest, - customType: string, - guildID: string, - resetType: string, + type: Quest, + customType: string, + guildID: string, + resetType: string, ): Promise { - let selectedModel: string; - if (customType === "custom") { - selectedModel = typeCheck[`custom${type}`]; - } else if (customType === "mixed") { - if (resetType === "custom") selectedModel = typeCheck[`custom${type}`]; - else selectedModel = typeCheck[type]; - } else { - selectedModel = type; - } - - return await usedQuestionModel.updateOne( - { guildID }, - { - $set: { - [selectedModel]: [], - }, - }, - ); + let selectedModel: string; + if (customType === "custom") { + selectedModel = typeCheck[`custom${type}`]; + } else if (customType === "mixed") { + if (resetType === "custom") selectedModel = typeCheck[`custom${type}`]; + else selectedModel = typeCheck[type]; + } else { + selectedModel = type; + } + + return await usedQuestionModel.updateOne( + { guildID }, + { + $set: { + [selectedModel]: [], + }, + }, + ); } diff --git a/src/util/keepAlive.ts b/src/util/keepAlive.ts index 97a91ac9..ddbc5959 100644 --- a/src/util/keepAlive.ts +++ b/src/util/keepAlive.ts @@ -17,7 +17,7 @@ export default class KeepAlive { const { route: path, limit, timeToReset: timeout } = log; captureMessage( `Rate limited on ${path} with a limit of ${limit} and a timeout of ${timeout}`, - ); + ); captureMessage( `Rate limited on ${path} with a limit of ${limit} and a timeout of ${timeout}`, ); diff --git a/src/util/webhookHandler.ts b/src/util/webhookHandler.ts index d0369eae..ed7a5fbe 100644 --- a/src/util/webhookHandler.ts +++ b/src/util/webhookHandler.ts @@ -37,7 +37,7 @@ export default class WebhookHandler { channel: WebHookCompatibleChannel, content: WebhookMessageCreateOptions, message: IQueueMessage, - overwriteProfile: boolean + overwriteProfile: boolean, ): Promise> { if (message.webhook.id && message.webhook.token) { const webhookClient = new WebhookClient({ @@ -49,7 +49,7 @@ export default class WebhookHandler { webhookClient, content, overwriteProfile, - message + message, ); if (result.success) { if (!message.thread && !message.autoPin) return result; @@ -70,7 +70,7 @@ export default class WebhookHandler { newWebhook.result, content, overwriteProfile, - message + message, ); if (result.success) { if (!message.thread && !message.autoPin) return result; @@ -95,7 +95,7 @@ export default class WebhookHandler { newWebhook.result, content, overwriteProfile, - message + message, ); if (result.success) { if (!message.thread && !message.autoPin) return result; @@ -126,7 +126,7 @@ export default class WebhookHandler { * If true, it will overwrite the webhook to the bot's name and avatar. */ overwriteProfile: boolean, - message: IQueueMessage + message: IQueueMessage, ): Promise> { if (overwriteProfile) { // Edit these if bot name/avatar ever changes @@ -147,19 +147,19 @@ export default class WebhookHandler { } private async webhookFallBack( channel: WebHookCompatibleChannel, - message: IQueueMessage + message: IQueueMessage, ): Promise> { const webhook = await this.createWebhook( channel, "Webhook token unavailable, creating new webhook", message.webhook.name, - message.webhook.avatar + message.webhook.avatar, ); if (webhook.success) { const result = await this.updateCache( channel.id, message.guildId, - webhook.result + webhook.result, ); if (result.success) { return webhook; @@ -172,7 +172,7 @@ export default class WebhookHandler { channel: WebHookCompatibleChannel, reason: string, fallbackName?: string, - fallbackAvatarURL?: string + fallbackAvatarURL?: string, ): Promise> { if (!channel.guild.members.me) return { @@ -214,7 +214,7 @@ export default class WebhookHandler { private async updateCache( channelId: string, guildId: string, - webhook: WebhookClient + webhook: WebhookClient, ): Promise> { try { const doc = await this.webhookModel.findOneAndUpdate( @@ -223,7 +223,7 @@ export default class WebhookHandler { webhookToken: cryptr.encrypt(webhook.token), webhookId: webhook.id, guildId: guildId, - } + }, ); if (doc) { return { success: true, result: doc }; @@ -231,7 +231,7 @@ export default class WebhookHandler { const createdEntry = await this.createEntryInCache( channelId, guildId, - webhook + webhook, ); return createdEntry; } catch (error) { @@ -241,7 +241,7 @@ export default class WebhookHandler { private async createEntryInCache( channelId: string, guildId: string, - webhook: WebhookClient + webhook: WebhookClient, ): Promise> { try { const doc = await this.webhookModel.create({ @@ -264,7 +264,7 @@ export default class WebhookHandler { } private async createThread( message: IQueueMessage, - apiReturnValue: APIMessage + apiReturnValue: APIMessage, ): Promise> { const date = new Date(); try { @@ -279,7 +279,7 @@ export default class WebhookHandler { ].join("/")} - Daily Message`, auto_archive_duration: "1440", }, - } + }, ); return { success: true, result: "Thread created" }; } catch (error) { @@ -289,15 +289,15 @@ export default class WebhookHandler { private async autoPinMessage( message: IQueueMessage, - apiReturnValue: APIMessage + apiReturnValue: APIMessage, ): Promise> { let pinChannel: any = await this.client.rest.get( - `/channels/${message.channelId}/pins` + `/channels/${message.channelId}/pins`, ); if (pinChannel) { pinChannel = pinChannel.filter( - (x: any) => x.application_id === this.client.user?.id + (x: any) => x.application_id === this.client.user?.id, ); } @@ -309,7 +309,7 @@ export default class WebhookHandler { `/channels/${pinChannel[0].channel_id}/pins/${pinChannel[0].id}`, { reason: "Automatic unpinning of daily message", - } + }, ); } @@ -317,7 +317,7 @@ export default class WebhookHandler { `/channels/${message.channelId}/pins/${apiReturnValue?.id}`, { reason: "Automatic pinning of daily message", - } + }, ); console.log("Pinned message"); return { success: true, result: "Pinned message" };