From 166d4743b391ecaeb18e91773897a71d400d9fe5 Mon Sep 17 00:00:00 2001 From: Dominik Koch Date: Wed, 4 Jun 2025 18:37:54 +0200 Subject: [PATCH 01/30] feat: question now prevents repeats --- src/util/Functions/jsonImport.ts | 186 ++++++++++++++++++++++--------- 1 file changed, 132 insertions(+), 54 deletions(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index accc1d60..c0f5cc02 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -172,6 +172,8 @@ export async function getQuestionsByType( customWwydQuestions: [], wyrQuestions: [], customWyrQuestions: [], + topicQuestions: [], + customTopicQuestions: [], }); usedQuestions = await usedQuestionModel.find({ @@ -186,28 +188,38 @@ export async function getQuestionsByType( ]); } - 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([]); + interface QuestionData { + id: string; + question: string; + translations?: { [key: string]: string }; + type?: string; } async function getRandomCustom(nin: string[]) { - return await GuildModel.aggregate([ + const customCount = await GuildModel.aggregate([ { $match: { guildID: guildDb.guildID } }, { $unwind: "$customMessages" }, { $match: { - "customMessages.id": { - $nin: nin, - }, "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, }, }, - { $sample: { size: 1 } }, + { $count: "total" }, + ]); + + if (!customCount[0]?.total) { + return null; + } + + const availableCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + "customMessages.id": { $nin: nin }, + }, + }, { $project: { id: "$customMessages.id", @@ -216,20 +228,96 @@ export async function getQuestionsByType( }, }, ]); + + if (availableCustomQuestions.length === 0) { + await reset(type as Quest, "custom", guildDb.guildID, "custom"); + + const allCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { + $project: { + id: "$customMessages.id", + question: "$customMessages.question", + type: "$customMessages.type", + }, + }, + ]); + + const randomIndex = Math.floor( + Math.random() * allCustomQuestions.length + ); + return [allCustomQuestions[randomIndex]]; + } + + const randomIndex = Math.floor( + Math.random() * availableCustomQuestions.length + ); + return [availableCustomQuestions[randomIndex]]; + } + + const hasCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { $count: "total" }, + ]); + + if (hasCustomQuestions[0]?.total > 0) { + const customQuestion = await getRandomCustom( + premium && enabled + ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] + : [] + ); + + if (!customQuestion?.[0]) { + return Promise.reject("Error getting custom question"); + } + + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } + ); + } + + return { + id: customQuestion[0].id, + question: customQuestion[0].question, + }; } - let newRandomCustomQuestion = await getRandomCustom( - premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [] + // Only get normal questions if there are no custom questions configured + let questionDatabase = await getDBQuestion( + premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] ); - if (!newRandomCustomQuestion[0]?.id && premium && enabled) { - await reset( - type as Quest, - guildDb.customTypes, - guildDb.guildID, - "custom" + if (!questionDatabase[0]?.id && premium && enabled) { + await reset(type as Quest, "regular", guildDb.guildID, "db"); + questionDatabase = await getDBQuestion([]); + } + + if (!questionDatabase[0]) { + return Promise.reject("No questions available"); + } + + const dbQuestion = questionDatabase[0] as QuestionData; + + // Track the used normal question for premium users + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[type]]: dbQuestion.id } } ); - newRandomCustomQuestion = await getRandomCustom([]); } let types = @@ -243,56 +331,46 @@ export async function getQuestionsByType( switch (types) { case "regular": result = { - id: questionDatabase[0].id, + id: dbQuestion.id, question: normalizedLanguage === "en_EN" - ? questionDatabase[0].question - : questionDatabase[0].translations[normalizedLanguage], + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; - break; case "mixed": { - const mixedQuestions = shuffle([ - ...questionDatabase.concat(newRandomCustomQuestion[0]), - ]); + const availableQuestions = questionDatabase.map( + (q: any) => ({ ...q }) as QuestionData + ); + const mixedQuestions = shuffle(availableQuestions); + const question = mixedQuestions[0] as QuestionData; + + if (!question) { + return Promise.reject("No questions available"); + } - const question = mixedQuestions[0] - ? mixedQuestions[0] - : mixedQuestions[1]; - result = { - id: question?.id, + id: question.id, question: normalizedLanguage === "en_EN" - ? question?.question - : question?.translations?.[normalizedLanguage] || - question?.question, + ? question.question + : question.translations?.[normalizedLanguage] || + question.question, }; break; } case "custom": result = { - id: newRandomCustomQuestion[0].id, - question: newRandomCustomQuestion[0].question, + id: dbQuestion.id, + question: + normalizedLanguage === "en_EN" + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; break; } - - if (premium && enabled) { - if (types === "custom") { - selectedModel = typeCheck[`custom${type}`]; - } else if (types === "mixed") { - if (result.id === questionDatabase[0].id) - selectedModel = typeCheck[type]; - else selectedModel = typeCheck[`custom${type}`]; - } else { - selectedModel = typeCheck[type]; - } - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [selectedModel]: result.id } } - ); - } } else { const questionDatabase = await selectedModel.aggregate([ { $sample: { size: 1 } }, From cafd9d5cfedd8ade657baced8394f754ecf256a7 Mon Sep 17 00:00:00 2001 From: Dominik Koch Date: Thu, 5 Jun 2025 18:17:01 +0200 Subject: [PATCH 02/30] fix: better qotd logging --- src/util/dailyMessage.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/util/dailyMessage.ts b/src/util/dailyMessage.ts index 2d08ba14..a6e2cc26 100644 --- a/src/util/dailyMessage.ts +++ b/src/util/dailyMessage.ts @@ -15,12 +15,12 @@ export default class DailyMessage { * Start the daily message Schedule */ async listen() { - let username = process.env.RABBITMQ_DEFAULT_USER || "" - let password = process.env.RABBITMQ_DEFAULT_PASS || "" + let username = process.env.RABBITMQ_DEFAULT_USER! + let password = process.env.RABBITMQ_DEFAULT_PASS! username = encodeURIComponent(username) password = encodeURIComponent(password) - let URI = process.env.RABBITMQ_URL || "fallback"; + const URI = process.env.RABBITMQ_URL!; const connection = await amqplib.connect(URI, { clientProperties: { connection_name: `client-cluster-${this.client.cluster.id}`, @@ -211,12 +211,15 @@ export default class DailyMessage { type: string, qid: string, ): EmbedBuilder { + console.log( + `Building embed for daily message: ${question} | ID: ${id} | Type: ${type} | QID: ${qid}`, + ); return new EmbedBuilder() .setColor("#0598F6") .setFooter({ text: `Daily Message | Type: ${type.replace(/^\w/, (content) => content.toUpperCase(), - )} | ID: ${id} QID: ${qid}`, + )} | ID: ${id}`, }) .setDescription(bold(question) as string); } From 27299a6f00c9bbcb634a6dc348a2f2cd32fb9687 Mon Sep 17 00:00:00 2001 From: Dominik Koch Date: Thu, 5 Jun 2025 18:39:51 +0200 Subject: [PATCH 03/30] Revert "feat: question now prevents repeats" This reverts commit 166d4743b391ecaeb18e91773897a71d400d9fe5. --- src/util/Functions/jsonImport.ts | 186 +++++++++---------------------- 1 file changed, 54 insertions(+), 132 deletions(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index c0f5cc02..accc1d60 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -172,8 +172,6 @@ export async function getQuestionsByType( customWwydQuestions: [], wyrQuestions: [], customWyrQuestions: [], - topicQuestions: [], - customTopicQuestions: [], }); usedQuestions = await usedQuestionModel.find({ @@ -188,38 +186,28 @@ export async function getQuestionsByType( ]); } - interface QuestionData { - id: string; - question: string; - translations?: { [key: string]: string }; - type?: string; + 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[]) { - const customCount = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { $count: "total" }, - ]); - - if (!customCount[0]?.total) { - return null; - } - - const availableCustomQuestions = await GuildModel.aggregate([ + return await GuildModel.aggregate([ { $match: { guildID: guildDb.guildID } }, { $unwind: "$customMessages" }, { $match: { + "customMessages.id": { + $nin: nin, + }, "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - "customMessages.id": { $nin: nin }, }, }, + { $sample: { size: 1 } }, { $project: { id: "$customMessages.id", @@ -228,96 +216,20 @@ export async function getQuestionsByType( }, }, ]); - - if (availableCustomQuestions.length === 0) { - await reset(type as Quest, "custom", guildDb.guildID, "custom"); - - const allCustomQuestions = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { - $project: { - id: "$customMessages.id", - question: "$customMessages.question", - type: "$customMessages.type", - }, - }, - ]); - - const randomIndex = Math.floor( - Math.random() * allCustomQuestions.length - ); - return [allCustomQuestions[randomIndex]]; - } - - const randomIndex = Math.floor( - Math.random() * availableCustomQuestions.length - ); - return [availableCustomQuestions[randomIndex]]; - } - - const hasCustomQuestions = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { $count: "total" }, - ]); - - if (hasCustomQuestions[0]?.total > 0) { - const customQuestion = await getRandomCustom( - premium && enabled - ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] - : [] - ); - - if (!customQuestion?.[0]) { - return Promise.reject("Error getting custom question"); - } - - if (premium && enabled) { - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } - ); - } - - return { - id: customQuestion[0].id, - question: customQuestion[0].question, - }; } - // Only get normal questions if there are no custom questions configured - let questionDatabase = await getDBQuestion( - premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] + let newRandomCustomQuestion = await getRandomCustom( + premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [] ); - if (!questionDatabase[0]?.id && premium && enabled) { - await reset(type as Quest, "regular", guildDb.guildID, "db"); - questionDatabase = await getDBQuestion([]); - } - - if (!questionDatabase[0]) { - return Promise.reject("No questions available"); - } - - const dbQuestion = questionDatabase[0] as QuestionData; - - // Track the used normal question for premium users - if (premium && enabled) { - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [typeCheck[type]]: dbQuestion.id } } + if (!newRandomCustomQuestion[0]?.id && premium && enabled) { + await reset( + type as Quest, + guildDb.customTypes, + guildDb.guildID, + "custom" ); + newRandomCustomQuestion = await getRandomCustom([]); } let types = @@ -331,46 +243,56 @@ export async function getQuestionsByType( switch (types) { case "regular": result = { - id: dbQuestion.id, + id: questionDatabase[0].id, question: normalizedLanguage === "en_EN" - ? dbQuestion.question - : dbQuestion.translations?.[normalizedLanguage] || - dbQuestion.question, + ? questionDatabase[0].question + : questionDatabase[0].translations[normalizedLanguage], }; + break; case "mixed": { - const availableQuestions = questionDatabase.map( - (q: any) => ({ ...q }) as QuestionData - ); - const mixedQuestions = shuffle(availableQuestions); - const question = mixedQuestions[0] as QuestionData; - - if (!question) { - return Promise.reject("No questions available"); - } + const mixedQuestions = shuffle([ + ...questionDatabase.concat(newRandomCustomQuestion[0]), + ]); + const question = mixedQuestions[0] + ? mixedQuestions[0] + : mixedQuestions[1]; + result = { - id: question.id, + id: question?.id, question: normalizedLanguage === "en_EN" - ? question.question - : question.translations?.[normalizedLanguage] || - question.question, + ? question?.question + : question?.translations?.[normalizedLanguage] || + question?.question, }; break; } case "custom": result = { - id: dbQuestion.id, - question: - normalizedLanguage === "en_EN" - ? dbQuestion.question - : dbQuestion.translations?.[normalizedLanguage] || - dbQuestion.question, + id: newRandomCustomQuestion[0].id, + question: newRandomCustomQuestion[0].question, }; break; } + + if (premium && enabled) { + if (types === "custom") { + selectedModel = typeCheck[`custom${type}`]; + } else if (types === "mixed") { + if (result.id === questionDatabase[0].id) + selectedModel = typeCheck[type]; + else selectedModel = typeCheck[`custom${type}`]; + } else { + selectedModel = typeCheck[type]; + } + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [selectedModel]: result.id } } + ); + } } else { const questionDatabase = await selectedModel.aggregate([ { $sample: { size: 1 } }, From 4eb667a608b15d034c8e23bb9004f8a08ca7d733 Mon Sep 17 00:00:00 2001 From: Dominik Koch Date: Thu, 5 Jun 2025 20:17:33 +0200 Subject: [PATCH 04/30] Reapply "feat: question now prevents repeats" This reverts commit 27299a6f00c9bbcb634a6dc348a2f2cd32fb9687. --- src/util/Functions/jsonImport.ts | 186 ++++++++++++++++++++++--------- 1 file changed, 132 insertions(+), 54 deletions(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index accc1d60..c0f5cc02 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -172,6 +172,8 @@ export async function getQuestionsByType( customWwydQuestions: [], wyrQuestions: [], customWyrQuestions: [], + topicQuestions: [], + customTopicQuestions: [], }); usedQuestions = await usedQuestionModel.find({ @@ -186,28 +188,38 @@ export async function getQuestionsByType( ]); } - 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([]); + interface QuestionData { + id: string; + question: string; + translations?: { [key: string]: string }; + type?: string; } async function getRandomCustom(nin: string[]) { - return await GuildModel.aggregate([ + const customCount = await GuildModel.aggregate([ { $match: { guildID: guildDb.guildID } }, { $unwind: "$customMessages" }, { $match: { - "customMessages.id": { - $nin: nin, - }, "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, }, }, - { $sample: { size: 1 } }, + { $count: "total" }, + ]); + + if (!customCount[0]?.total) { + return null; + } + + const availableCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + "customMessages.id": { $nin: nin }, + }, + }, { $project: { id: "$customMessages.id", @@ -216,20 +228,96 @@ export async function getQuestionsByType( }, }, ]); + + if (availableCustomQuestions.length === 0) { + await reset(type as Quest, "custom", guildDb.guildID, "custom"); + + const allCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { + $project: { + id: "$customMessages.id", + question: "$customMessages.question", + type: "$customMessages.type", + }, + }, + ]); + + const randomIndex = Math.floor( + Math.random() * allCustomQuestions.length + ); + return [allCustomQuestions[randomIndex]]; + } + + const randomIndex = Math.floor( + Math.random() * availableCustomQuestions.length + ); + return [availableCustomQuestions[randomIndex]]; + } + + const hasCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { $count: "total" }, + ]); + + if (hasCustomQuestions[0]?.total > 0) { + const customQuestion = await getRandomCustom( + premium && enabled + ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] + : [] + ); + + if (!customQuestion?.[0]) { + return Promise.reject("Error getting custom question"); + } + + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } + ); + } + + return { + id: customQuestion[0].id, + question: customQuestion[0].question, + }; } - let newRandomCustomQuestion = await getRandomCustom( - premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [] + // Only get normal questions if there are no custom questions configured + let questionDatabase = await getDBQuestion( + premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] ); - if (!newRandomCustomQuestion[0]?.id && premium && enabled) { - await reset( - type as Quest, - guildDb.customTypes, - guildDb.guildID, - "custom" + if (!questionDatabase[0]?.id && premium && enabled) { + await reset(type as Quest, "regular", guildDb.guildID, "db"); + questionDatabase = await getDBQuestion([]); + } + + if (!questionDatabase[0]) { + return Promise.reject("No questions available"); + } + + const dbQuestion = questionDatabase[0] as QuestionData; + + // Track the used normal question for premium users + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[type]]: dbQuestion.id } } ); - newRandomCustomQuestion = await getRandomCustom([]); } let types = @@ -243,56 +331,46 @@ export async function getQuestionsByType( switch (types) { case "regular": result = { - id: questionDatabase[0].id, + id: dbQuestion.id, question: normalizedLanguage === "en_EN" - ? questionDatabase[0].question - : questionDatabase[0].translations[normalizedLanguage], + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; - break; case "mixed": { - const mixedQuestions = shuffle([ - ...questionDatabase.concat(newRandomCustomQuestion[0]), - ]); + const availableQuestions = questionDatabase.map( + (q: any) => ({ ...q }) as QuestionData + ); + const mixedQuestions = shuffle(availableQuestions); + const question = mixedQuestions[0] as QuestionData; + + if (!question) { + return Promise.reject("No questions available"); + } - const question = mixedQuestions[0] - ? mixedQuestions[0] - : mixedQuestions[1]; - result = { - id: question?.id, + id: question.id, question: normalizedLanguage === "en_EN" - ? question?.question - : question?.translations?.[normalizedLanguage] || - question?.question, + ? question.question + : question.translations?.[normalizedLanguage] || + question.question, }; break; } case "custom": result = { - id: newRandomCustomQuestion[0].id, - question: newRandomCustomQuestion[0].question, + id: dbQuestion.id, + question: + normalizedLanguage === "en_EN" + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; break; } - - if (premium && enabled) { - if (types === "custom") { - selectedModel = typeCheck[`custom${type}`]; - } else if (types === "mixed") { - if (result.id === questionDatabase[0].id) - selectedModel = typeCheck[type]; - else selectedModel = typeCheck[`custom${type}`]; - } else { - selectedModel = typeCheck[type]; - } - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [selectedModel]: result.id } } - ); - } } else { const questionDatabase = await selectedModel.aggregate([ { $sample: { size: 1 } }, From edddd76e1c5b290e80b53b29dec7367ed044cdfb Mon Sep 17 00:00:00 2001 From: Dominik Koch Date: Thu, 5 Jun 2025 20:30:19 +0200 Subject: [PATCH 05/30] fix: change selectedModel variable to const for better immutability --- src/util/Functions/jsonImport.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index c0f5cc02..ce693d04 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -144,7 +144,7 @@ export async function getQuestionsByType( topic: topicModel, }; - let selectedModel = models[type.toLowerCase()]; + const selectedModel = models[type.toLowerCase()]; let result: QuestionResult = { id: "", question: "" }; From 82d8815a7c63f8e233cc697c7a3846a05a0b5a8f Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Tue, 24 Jun 2025 12:49:11 -0400 Subject: [PATCH 06/30] Small fix until we fully remake DMS (I hope soon) --- src/util/Functions/jsonImport.ts | 376 ++++++++++++++++++++----------- 1 file changed, 244 insertions(+), 132 deletions(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index ce693d04..7fd6baf4 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -144,7 +144,9 @@ export async function getQuestionsByType( topic: topicModel, }; - const selectedModel = models[type.toLowerCase()]; + // const selectedModel = models[type.toLowerCase()]; + let selectedModel = models[type.toLowerCase()]; + let result: QuestionResult = { id: "", question: "" }; @@ -188,38 +190,28 @@ export async function getQuestionsByType( ]); } - interface QuestionData { - id: string; - question: string; - translations?: { [key: string]: string }; - type?: string; + 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[]) { - const customCount = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { $count: "total" }, - ]); - - if (!customCount[0]?.total) { - return null; - } - - const availableCustomQuestions = await GuildModel.aggregate([ + return await GuildModel.aggregate([ { $match: { guildID: guildDb.guildID } }, { $unwind: "$customMessages" }, { $match: { + "customMessages.id": { + $nin: nin, + }, "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - "customMessages.id": { $nin: nin }, }, }, + { $sample: { size: 1 } }, { $project: { id: "$customMessages.id", @@ -228,149 +220,269 @@ export async function getQuestionsByType( }, }, ]); - - if (availableCustomQuestions.length === 0) { - await reset(type as Quest, "custom", guildDb.guildID, "custom"); - - const allCustomQuestions = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { - $project: { - id: "$customMessages.id", - question: "$customMessages.question", - type: "$customMessages.type", - }, - }, - ]); - - const randomIndex = Math.floor( - Math.random() * allCustomQuestions.length - ); - return [allCustomQuestions[randomIndex]]; - } - - const randomIndex = Math.floor( - Math.random() * availableCustomQuestions.length - ); - return [availableCustomQuestions[randomIndex]]; } - const hasCustomQuestions = await GuildModel.aggregate([ - { $match: { guildID: guildDb.guildID } }, - { $unwind: "$customMessages" }, - { - $match: { - "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - }, - }, - { $count: "total" }, - ]); - - if (hasCustomQuestions[0]?.total > 0) { - const customQuestion = await getRandomCustom( - premium && enabled - ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] - : [] - ); - - if (!customQuestion?.[0]) { - return Promise.reject("Error getting custom question"); - } - - if (premium && enabled) { - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } - ); - } - - return { - id: customQuestion[0].id, - question: customQuestion[0].question, - }; - } - - // Only get normal questions if there are no custom questions configured - let questionDatabase = await getDBQuestion( - premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] + let newRandomCustomQuestion = await getRandomCustom( + premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [] ); - if (!questionDatabase[0]?.id && premium && enabled) { - await reset(type as Quest, "regular", guildDb.guildID, "db"); - questionDatabase = await getDBQuestion([]); - } - - if (!questionDatabase[0]) { - return Promise.reject("No questions available"); - } - - const dbQuestion = questionDatabase[0] as QuestionData; - - // Track the used normal question for premium users - if (premium && enabled) { - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [typeCheck[type]]: dbQuestion.id } } + 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 || guildDb.customTypes; - if (guildDb.welcome && guildDb.welcomeChannel === channel) { types = guildDb.welcomeType; } - switch (types) { case "regular": result = { - id: dbQuestion.id, + id: questionDatabase[0].id, question: normalizedLanguage === "en_EN" - ? dbQuestion.question - : dbQuestion.translations?.[normalizedLanguage] || - dbQuestion.question, + ? questionDatabase[0].question + : questionDatabase[0].translations[normalizedLanguage], }; + break; case "mixed": { - const availableQuestions = questionDatabase.map( - (q: any) => ({ ...q }) as QuestionData - ); - const mixedQuestions = shuffle(availableQuestions); - const question = mixedQuestions[0] as QuestionData; + const mixedQuestions = shuffle([ + ...questionDatabase.concat(newRandomCustomQuestion[0]), + ]); - if (!question) { - return Promise.reject("No questions available"); - } + const question = mixedQuestions[0] + ? mixedQuestions[0] + : mixedQuestions[1]; result = { - id: question.id, + id: question?.id, question: normalizedLanguage === "en_EN" - ? question.question - : question.translations?.[normalizedLanguage] || - question.question, + ? question?.question + : question?.translations?.[normalizedLanguage] || + question?.question, }; break; } case "custom": result = { - id: dbQuestion.id, - question: - normalizedLanguage === "en_EN" - ? dbQuestion.question - : dbQuestion.translations?.[normalizedLanguage] || - dbQuestion.question, + id: newRandomCustomQuestion[0].id, + question: newRandomCustomQuestion[0].question, }; break; } + + if (premium && enabled) { + if (types === "custom") { + selectedModel = typeCheck[`custom${type}`]; + } else if (types === "mixed") { + if (result.id === questionDatabase[0].id) + selectedModel = typeCheck[type]; + else selectedModel = typeCheck[`custom${type}`]; + } else { + selectedModel = typeCheck[type]; + } + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [selectedModel]: result.id } } + ); + } + + // @@ TODO: Make the below code work in the future, but currently it doesn't work - ForGetFulSkyBro + + // interface QuestionData { + // id: string; + // question: string; + // translations?: { [key: string]: string }; + // type?: string; + // } + + // async function getRandomCustom(nin: string[]) { + // const customCount = await GuildModel.aggregate([ + // { $match: { guildID: guildDb.guildID } }, + // { $unwind: "$customMessages" }, + // { + // $match: { + // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + // }, + // }, + // { $count: "total" }, + // ]); + + // if (!customCount[0]?.total) { + // return null; + // } + + // const availableCustomQuestions = await GuildModel.aggregate([ + // { $match: { guildID: guildDb.guildID } }, + // { $unwind: "$customMessages" }, + // { + // $match: { + // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + // "customMessages.id": { $nin: nin }, + // }, + // }, + // { + // $project: { + // id: "$customMessages.id", + // question: "$customMessages.question", + // type: "$customMessages.type", + // }, + // }, + // ]); + + // if (availableCustomQuestions.length === 0) { + // await reset(type as Quest, "custom", guildDb.guildID, "custom"); + + // const allCustomQuestions = await GuildModel.aggregate([ + // { $match: { guildID: guildDb.guildID } }, + // { $unwind: "$customMessages" }, + // { + // $match: { + // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + // }, + // }, + // { + // $project: { + // id: "$customMessages.id", + // question: "$customMessages.question", + // type: "$customMessages.type", + // }, + // }, + // ]); + + // const randomIndex = Math.floor( + // Math.random() * allCustomQuestions.length + // ); + // return [allCustomQuestions[randomIndex]]; + // } + + // const randomIndex = Math.floor( + // Math.random() * availableCustomQuestions.length + // ); + // return [availableCustomQuestions[randomIndex]]; + // } + + // const hasCustomQuestions = await GuildModel.aggregate([ + // { $match: { guildID: guildDb.guildID } }, + // { $unwind: "$customMessages" }, + // { + // $match: { + // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + // }, + // }, + // { $count: "total" }, + // ]); + + // if (hasCustomQuestions[0]?.total > 0) { + // const customQuestion = await getRandomCustom( + // premium && enabled + // ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] + // : [] + // ); + + // if (!customQuestion?.[0]) { + // return Promise.reject("Error getting custom question"); + // } + + // if (premium && enabled) { + // await usedQuestionModel.updateOne( + // { guildID: guildDb.guildID }, + // { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } + // ); + // } + + // return { + // id: customQuestion[0].id, + // question: customQuestion[0].question, + // }; + // } + + // // Only get normal questions if there are no custom questions configured + // let questionDatabase = await getDBQuestion( + // premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] + // ); + + // if (!questionDatabase[0]?.id && premium && enabled) { + // await reset(type as Quest, "regular", guildDb.guildID, "db"); + // questionDatabase = await getDBQuestion([]); + // } + + // if (!questionDatabase[0]) { + // return Promise.reject("No questions available"); + // } + + // const dbQuestion = questionDatabase[0] as QuestionData; + + // // Track the used normal question for premium users + // if (premium && enabled) { + // await usedQuestionModel.updateOne( + // { guildID: guildDb.guildID }, + // { $push: { [typeCheck[type]]: dbQuestion.id } } + // ); + // } + + // let types = + // guildDb.channelTypes.find((e) => e.channelId === channel)?.questionType || + // guildDb.customTypes; + + // if (guildDb.welcome && guildDb.welcomeChannel === channel) { + // types = guildDb.welcomeType; + // } + + // switch (types) { + // case "regular": + // result = { + // id: dbQuestion.id, + // question: + // normalizedLanguage === "en_EN" + // ? dbQuestion.question + // : dbQuestion.translations?.[normalizedLanguage] || + // dbQuestion.question, + // }; + // break; + // case "mixed": { + // const availableQuestions = questionDatabase.map( + // (q: any) => ({ ...q }) as QuestionData + // ); + // const mixedQuestions = shuffle(availableQuestions); + // const question = mixedQuestions[0] as QuestionData; + + // if (!question) { + // return Promise.reject("No questions available"); + // } + + // result = { + // id: question.id, + // question: + // normalizedLanguage === "en_EN" + // ? question.question + // : question.translations?.[normalizedLanguage] || + // question.question, + // }; + // break; + // } + // case "custom": + // result = { + // id: dbQuestion.id, + // question: + // normalizedLanguage === "en_EN" + // ? dbQuestion.question + // : dbQuestion.translations?.[normalizedLanguage] || + // dbQuestion.question, + // }; + // break; + // } + + } else { const questionDatabase = await selectedModel.aggregate([ { $sample: { size: 1 } }, From 4ad98a8d68eff41a0bbdd5feb15cd79f8a8811be Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Tue, 24 Jun 2025 13:00:51 -0400 Subject: [PATCH 07/30] Revert my last commit :/ --- src/util/Functions/jsonImport.ts | 376 +++++++++++-------------------- 1 file changed, 132 insertions(+), 244 deletions(-) diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index 7fd6baf4..ce693d04 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -144,9 +144,7 @@ export async function getQuestionsByType( topic: topicModel, }; - // const selectedModel = models[type.toLowerCase()]; - let selectedModel = models[type.toLowerCase()]; - + const selectedModel = models[type.toLowerCase()]; let result: QuestionResult = { id: "", question: "" }; @@ -190,28 +188,38 @@ export async function getQuestionsByType( ]); } - 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([]); + interface QuestionData { + id: string; + question: string; + translations?: { [key: string]: string }; + type?: string; } async function getRandomCustom(nin: string[]) { - return await GuildModel.aggregate([ + const customCount = await GuildModel.aggregate([ { $match: { guildID: guildDb.guildID } }, { $unwind: "$customMessages" }, { $match: { - "customMessages.id": { - $nin: nin, - }, "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, }, }, - { $sample: { size: 1 } }, + { $count: "total" }, + ]); + + if (!customCount[0]?.total) { + return null; + } + + const availableCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + "customMessages.id": { $nin: nin }, + }, + }, { $project: { id: "$customMessages.id", @@ -220,269 +228,149 @@ export async function getQuestionsByType( }, }, ]); + + if (availableCustomQuestions.length === 0) { + await reset(type as Quest, "custom", guildDb.guildID, "custom"); + + const allCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { + $project: { + id: "$customMessages.id", + question: "$customMessages.question", + type: "$customMessages.type", + }, + }, + ]); + + const randomIndex = Math.floor( + Math.random() * allCustomQuestions.length + ); + return [allCustomQuestions[randomIndex]]; + } + + const randomIndex = Math.floor( + Math.random() * availableCustomQuestions.length + ); + return [availableCustomQuestions[randomIndex]]; } - let newRandomCustomQuestion = await getRandomCustom( - premium && enabled ? usedQuestions[0][typeCheck[`custom${type}`]] : [] + const hasCustomQuestions = await GuildModel.aggregate([ + { $match: { guildID: guildDb.guildID } }, + { $unwind: "$customMessages" }, + { + $match: { + "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, + }, + }, + { $count: "total" }, + ]); + + if (hasCustomQuestions[0]?.total > 0) { + const customQuestion = await getRandomCustom( + premium && enabled + ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] + : [] + ); + + if (!customQuestion?.[0]) { + return Promise.reject("Error getting custom question"); + } + + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } + ); + } + + return { + id: customQuestion[0].id, + question: customQuestion[0].question, + }; + } + + // Only get normal questions if there are no custom questions configured + let questionDatabase = await getDBQuestion( + premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] ); - if (!newRandomCustomQuestion[0]?.id && premium && enabled) { - await reset( - type as Quest, - guildDb.customTypes, - guildDb.guildID, - "custom" + if (!questionDatabase[0]?.id && premium && enabled) { + await reset(type as Quest, "regular", guildDb.guildID, "db"); + questionDatabase = await getDBQuestion([]); + } + + if (!questionDatabase[0]) { + return Promise.reject("No questions available"); + } + + const dbQuestion = questionDatabase[0] as QuestionData; + + // Track the used normal question for premium users + if (premium && enabled) { + await usedQuestionModel.updateOne( + { guildID: guildDb.guildID }, + { $push: { [typeCheck[type]]: dbQuestion.id } } ); - newRandomCustomQuestion = await getRandomCustom([]); } let types = guildDb.channelTypes.find((e) => e.channelId === channel)?.questionType || guildDb.customTypes; + if (guildDb.welcome && guildDb.welcomeChannel === channel) { types = guildDb.welcomeType; } + switch (types) { case "regular": result = { - id: questionDatabase[0].id, + id: dbQuestion.id, question: normalizedLanguage === "en_EN" - ? questionDatabase[0].question - : questionDatabase[0].translations[normalizedLanguage], + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; - break; case "mixed": { - const mixedQuestions = shuffle([ - ...questionDatabase.concat(newRandomCustomQuestion[0]), - ]); + const availableQuestions = questionDatabase.map( + (q: any) => ({ ...q }) as QuestionData + ); + const mixedQuestions = shuffle(availableQuestions); + const question = mixedQuestions[0] as QuestionData; - const question = mixedQuestions[0] - ? mixedQuestions[0] - : mixedQuestions[1]; + if (!question) { + return Promise.reject("No questions available"); + } result = { - id: question?.id, + id: question.id, question: normalizedLanguage === "en_EN" - ? question?.question - : question?.translations?.[normalizedLanguage] || - question?.question, + ? question.question + : question.translations?.[normalizedLanguage] || + question.question, }; break; } case "custom": result = { - id: newRandomCustomQuestion[0].id, - question: newRandomCustomQuestion[0].question, + id: dbQuestion.id, + question: + normalizedLanguage === "en_EN" + ? dbQuestion.question + : dbQuestion.translations?.[normalizedLanguage] || + dbQuestion.question, }; break; } - - if (premium && enabled) { - if (types === "custom") { - selectedModel = typeCheck[`custom${type}`]; - } else if (types === "mixed") { - if (result.id === questionDatabase[0].id) - selectedModel = typeCheck[type]; - else selectedModel = typeCheck[`custom${type}`]; - } else { - selectedModel = typeCheck[type]; - } - await usedQuestionModel.updateOne( - { guildID: guildDb.guildID }, - { $push: { [selectedModel]: result.id } } - ); - } - - // @@ TODO: Make the below code work in the future, but currently it doesn't work - ForGetFulSkyBro - - // interface QuestionData { - // id: string; - // question: string; - // translations?: { [key: string]: string }; - // type?: string; - // } - - // async function getRandomCustom(nin: string[]) { - // const customCount = await GuildModel.aggregate([ - // { $match: { guildID: guildDb.guildID } }, - // { $unwind: "$customMessages" }, - // { - // $match: { - // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - // }, - // }, - // { $count: "total" }, - // ]); - - // if (!customCount[0]?.total) { - // return null; - // } - - // const availableCustomQuestions = await GuildModel.aggregate([ - // { $match: { guildID: guildDb.guildID } }, - // { $unwind: "$customMessages" }, - // { - // $match: { - // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - // "customMessages.id": { $nin: nin }, - // }, - // }, - // { - // $project: { - // id: "$customMessages.id", - // question: "$customMessages.question", - // type: "$customMessages.type", - // }, - // }, - // ]); - - // if (availableCustomQuestions.length === 0) { - // await reset(type as Quest, "custom", guildDb.guildID, "custom"); - - // const allCustomQuestions = await GuildModel.aggregate([ - // { $match: { guildID: guildDb.guildID } }, - // { $unwind: "$customMessages" }, - // { - // $match: { - // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - // }, - // }, - // { - // $project: { - // id: "$customMessages.id", - // question: "$customMessages.question", - // type: "$customMessages.type", - // }, - // }, - // ]); - - // const randomIndex = Math.floor( - // Math.random() * allCustomQuestions.length - // ); - // return [allCustomQuestions[randomIndex]]; - // } - - // const randomIndex = Math.floor( - // Math.random() * availableCustomQuestions.length - // ); - // return [availableCustomQuestions[randomIndex]]; - // } - - // const hasCustomQuestions = await GuildModel.aggregate([ - // { $match: { guildID: guildDb.guildID } }, - // { $unwind: "$customMessages" }, - // { - // $match: { - // "customMessages.type": type === "whatwouldyoudo" ? "wwyd" : type, - // }, - // }, - // { $count: "total" }, - // ]); - - // if (hasCustomQuestions[0]?.total > 0) { - // const customQuestion = await getRandomCustom( - // premium && enabled - // ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] - // : [] - // ); - - // if (!customQuestion?.[0]) { - // return Promise.reject("Error getting custom question"); - // } - - // if (premium && enabled) { - // await usedQuestionModel.updateOne( - // { guildID: guildDb.guildID }, - // { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } - // ); - // } - - // return { - // id: customQuestion[0].id, - // question: customQuestion[0].question, - // }; - // } - - // // Only get normal questions if there are no custom questions configured - // let questionDatabase = await getDBQuestion( - // premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] - // ); - - // if (!questionDatabase[0]?.id && premium && enabled) { - // await reset(type as Quest, "regular", guildDb.guildID, "db"); - // questionDatabase = await getDBQuestion([]); - // } - - // if (!questionDatabase[0]) { - // return Promise.reject("No questions available"); - // } - - // const dbQuestion = questionDatabase[0] as QuestionData; - - // // Track the used normal question for premium users - // if (premium && enabled) { - // await usedQuestionModel.updateOne( - // { guildID: guildDb.guildID }, - // { $push: { [typeCheck[type]]: dbQuestion.id } } - // ); - // } - - // let types = - // guildDb.channelTypes.find((e) => e.channelId === channel)?.questionType || - // guildDb.customTypes; - - // if (guildDb.welcome && guildDb.welcomeChannel === channel) { - // types = guildDb.welcomeType; - // } - - // switch (types) { - // case "regular": - // result = { - // id: dbQuestion.id, - // question: - // normalizedLanguage === "en_EN" - // ? dbQuestion.question - // : dbQuestion.translations?.[normalizedLanguage] || - // dbQuestion.question, - // }; - // break; - // case "mixed": { - // const availableQuestions = questionDatabase.map( - // (q: any) => ({ ...q }) as QuestionData - // ); - // const mixedQuestions = shuffle(availableQuestions); - // const question = mixedQuestions[0] as QuestionData; - - // if (!question) { - // return Promise.reject("No questions available"); - // } - - // result = { - // id: question.id, - // question: - // normalizedLanguage === "en_EN" - // ? question.question - // : question.translations?.[normalizedLanguage] || - // question.question, - // }; - // break; - // } - // case "custom": - // result = { - // id: dbQuestion.id, - // question: - // normalizedLanguage === "en_EN" - // ? dbQuestion.question - // : dbQuestion.translations?.[normalizedLanguage] || - // dbQuestion.question, - // }; - // break; - // } - - } else { const questionDatabase = await selectedModel.aggregate([ { $sample: { size: 1 } }, From d20f660092948526aba27d372063619f20ee50ac Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:30:56 -0400 Subject: [PATCH 08/30] fix(custom import): made the function actually work --- src/commands/settings/custom.ts | 282 ++++++++++++++++---------------- 1 file changed, 144 insertions(+), 138 deletions(-) diff --git a/src/commands/settings/custom.ts b/src/commands/settings/custom.ts index a5217dc9..a52a51e2 100644 --- a/src/commands/settings/custom.ts +++ b/src/commands/settings/custom.ts @@ -42,7 +42,7 @@ const command: ChatInputCommand = { option .setName("options") .setDescription( - "Select which category you want this custom message to be in.", + "Select which category you want this custom message to be in." ) .setRequired(true) .addChoices( @@ -51,17 +51,17 @@ const command: ChatInputCommand = { { name: "What Would You Do", value: "wwyd" }, { name: "Truth", value: "truth" }, { name: "Dare", value: "dare" }, - { name: "Topic", value: "topic" }, - ), + { name: "Topic", value: "topic" } + ) ) .addStringOption((option) => option .setName("message") .setDescription( - "Input a message to create a custom WouldYou message.", + "Input a message to create a custom WouldYou message." ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand((subcommand) => subcommand @@ -71,18 +71,18 @@ const command: ChatInputCommand = { option .setName("message") .setDescription("Input a custom WouldYou ID number to remove it.") - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand((subcommand) => subcommand .setName("removeall") - .setDescription("Removes all custom messages."), + .setDescription("Removes all custom messages.") ) .addSubcommand((subcommand) => subcommand .setName("view") - .setDescription("Views all of your custom WouldYou messages"), + .setDescription("Views all of your custom WouldYou messages") ) .addSubcommand((subcommand) => subcommand @@ -92,15 +92,15 @@ const command: ChatInputCommand = { option .setName("attachment") .setDescription( - "Import a JSON file containing useless or useful Would You custom messages.", + "Import a JSON file containing useless or useful Would You custom messages." ) - .setRequired(true), - ), + .setRequired(true) + ) ) .addSubcommand((subcommand) => subcommand .setName("export") - .setDescription("Exports custom messages into a JSON file."), + .setDescription("Exports custom messages into a JSON file.") ), execute: async (interaction, client, guildDb) => { @@ -110,7 +110,7 @@ const command: ChatInputCommand = { if ( (interaction?.member?.permissions as Readonly).has( - PermissionFlagsBits.ManageGuild, + PermissionFlagsBits.ManageGuild ) ) { switch (interaction.options.getSubcommand()) { @@ -130,7 +130,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Premium") .setStyle(ButtonStyle.Link) - .setURL("https://wouldyoubot.gg/premium"), + .setURL("https://wouldyoubot.gg/premium") ); interaction.reply({ content: `:x: ${client.translation.get( @@ -138,7 +138,7 @@ const command: ChatInputCommand = { "wyCustom.error.limit", { type: `\`${option}\``, - }, + } )}`, components: [premiumButton], ephemeral: true, @@ -154,22 +154,22 @@ const command: ChatInputCommand = { client, message || "", newID, - guildDb, + guildDb ); else if (option === "wwyd") generativeText = generateWWYD( client, message || "", newID, - guildDb, + guildDb ); else generativeText = { value: true, type: option }; typeEmbed = new EmbedBuilder() .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.title", - ), + "wyCustom.success.embedAdd.title" + ) ) .setColor("#0598F4") .setDescription( @@ -184,29 +184,29 @@ const command: ChatInputCommand = { generativeText?.type === "wouldyourather" ? client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descWYR", + "wyCustom.success.embedAdd.descWYR" ) : generativeText?.type === "wwyd" ? client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descWWYD", + "wyCustom.success.embedAdd.descWWYD" ) : client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descNHIE", + "wyCustom.success.embedAdd.descNHIE" ), - }, + } )}\n\n` }**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}**: ${newID}\n**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descCat", + "wyCustom.success.embedAdd.descCat" )}**: ${option}\n\n**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descCont", - )}**: \`${message}\``, + "wyCustom.success.embedAdd.descCont" + )}**: \`${message}\`` ) .setFooter({ text: `Would You ${ @@ -229,7 +229,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: guildDb.customMessages, }, - true, + true ); const add = @@ -241,7 +241,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Don't Add") .setStyle(ButtonStyle.Secondary) - .setCustomId(`wycustom_remove-${newID}`), + .setCustomId(`wycustom_remove-${newID}`) ); const addDisable = @@ -255,7 +255,7 @@ const command: ChatInputCommand = { .setLabel("Don't Add") .setDisabled(true) .setStyle(ButtonStyle.Secondary) - .setCustomId("wycustom_remove"), + .setCustomId("wycustom_remove") ); interaction @@ -269,7 +269,7 @@ const command: ChatInputCommand = { embeds: [typeEmbed], components: [add], ephemeral: true, - }, + } ) .then((msg) => setTimeout(() => { @@ -277,7 +277,7 @@ const command: ChatInputCommand = { msg.edit({ components: [addDisable] }); client.customAdd.delete(newID); } - }, 30 * 1000), + }, 30 * 1000) ) .catch((err) => { console.log(err); @@ -291,8 +291,8 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedRemove.title", - ), + "wyCustom.success.embedRemove.title" + ) ) .setColor("#0598F4") .setFooter({ @@ -311,7 +311,7 @@ const command: ChatInputCommand = { ephemeral: true, }); const filtered = guildDb.customMessages.filter( - (c) => c.id !== message, + (c) => c.id !== message ); await client.database.updateGuild( @@ -320,7 +320,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: filtered, }, - true, + true ); break; } @@ -329,7 +329,7 @@ const command: ChatInputCommand = { interaction.reply({ content: client.translation.get( guildDb?.language, - "wyCustom.success.embedRemoveAll.none", + "wyCustom.success.embedRemoveAll.none" ), ephemeral: true, }); @@ -340,8 +340,8 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedRemoveAll.title", - ), + "wyCustom.success.embedRemoveAll.title" + ) ) .setColor("#0598F4") .setFooter({ @@ -358,7 +358,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Decline") .setStyle(ButtonStyle.Secondary) - .setCustomId("wycustom_decline"), + .setCustomId("wycustom_decline") ); interaction.reply({ @@ -374,7 +374,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.empty", + "wyCustom.error.empty" ), }); return; @@ -403,17 +403,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg", - )}: ${s.question}`, + "wyCustom.success.embedAdd.descMsg" + )}: ${s.question}` ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5), + (a, r) => data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -423,17 +423,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatNHIE", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatNHIE" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -448,17 +448,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg", - )}: ${s.question}`, + "wyCustom.success.embedAdd.descMsg" + )}: ${s.question}` ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5), + (a, r) => data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -468,17 +468,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatWYR", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatWYR" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -492,17 +492,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg", - )}: ${s.question}`, + "wyCustom.success.embedAdd.descMsg" + )}: ${s.question}` ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5), + (a, r) => data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -512,17 +512,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatTRUTH", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatTRUTH" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -536,17 +536,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg", - )}: ${s.question}`, + "wyCustom.success.embedAdd.descMsg" + )}: ${s.question}` ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5), + (a, r) => data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -556,17 +556,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatDARE", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatDARE" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -580,17 +580,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID", + "wyCustom.success.embedAdd.descID" )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg", - )}: ${s.question}`, + "wyCustom.success.embedAdd.descMsg" + )}: ${s.question}` ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5), + (a, r) => data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -600,17 +600,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatWWYD", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatWWYD" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -622,7 +622,7 @@ const command: ChatInputCommand = { .filter((c) => c.type === "topic") .map((s, i) => `${s.id}: ${s.question}`); data = Array.from({ length: Math.ceil(data.length / 5) }, (a, r) => - data.slice(r * 5, r * 5 + 5), + data.slice(r * 5, r * 5 + 5) ); Math.ceil(data.length / 5); @@ -632,17 +632,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title", - ), + "wyCustom.success.paginator.title" + ) ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatTOPIC", - )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, + "wyCustom.success.paginator.descCatTOPIC" + )}\n\n${e.slice(0, 5).join("\n\n").toString()}` ) - .setColor("#0795F6"), - ), + .setColor("#0795F6") + ) ); } @@ -657,7 +657,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att1", + "wyCustom.error.import.att1" ), }); return; @@ -668,7 +668,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att2", + "wyCustom.error.import.att2" ), }); return; @@ -691,7 +691,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att3", + "wyCustom.error.import.att3" ), }); return; @@ -711,7 +711,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4", + "wyCustom.error.import.att4" ), }); return; @@ -731,37 +731,43 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4", + "wyCustom.error.import.att4" ), }); return; } - const all = []; - for (const key in response.data) { - if (!response.data.hasOwnProperty(key)) continue; - if ( - guildDb.customMessages.filter((e) => e.type === key).length + - response.data[key].length > - 100 - ) - all.push(key); + let prem = []; + if (!(await client.premium.check(interaction.guildId)).result) { + prem.push(true); } + const all = []; for (const key in response.data) { if (!response.data.hasOwnProperty(key)) continue; if ( - !(await client.premium.check(interaction.guildId)).result && + prem.length > 0 && guildDb.customMessages.filter((e) => e.type === key).length + response.data[key].length > 100 ) { + for (const key in response.data) { + if (!response.data.hasOwnProperty(key)) continue; + if ( + guildDb.customMessages.filter((e) => e.type === key) + .length + + response.data[key].length > + 100 + ) + all.push(key); + } + const premiumButton = new ActionRowBuilder().addComponents( new ButtonBuilder() .setLabel("Premium") .setStyle(ButtonStyle.Link) - .setURL("https://wouldyoubot.gg/premium"), + .setURL("https://wouldyoubot.gg/premium") ); interaction.editReply({ @@ -770,7 +776,7 @@ const command: ChatInputCommand = { "wyCustom.error.limit", { type: all.map((e) => `\`${e}\``).join(", "), - }, + } )}\n\n${client.translation.get(guildDb?.language, "wyCustom.error.addToLimit")}`, components: [premiumButton], }); @@ -785,7 +791,7 @@ const command: ChatInputCommand = { return interaction.editReply({ content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4", + "wyCustom.error.import.att4" ), components: [], }); @@ -795,10 +801,10 @@ const command: ChatInputCommand = { if (response.data.wouldyourather) { let i = guildDb.customMessages.filter( - (e) => e.type === "wouldyourather", + (e) => e.type === "wouldyourather" ).length; response.data.wouldyourather.map((d: any) => { - if (i === 100) return; + if (prem.length > 0 && i === 100) return; i++; const newID = uuidv4(); guildDb.customMessages.push({ @@ -811,10 +817,10 @@ const command: ChatInputCommand = { if (response.data.truth) { let i = guildDb.customMessages.filter( - (e) => e.type === "truth", + (e) => e.type === "truth" ).length; response.data.truth.map((d: any) => { - if (i === 100) return; + if (prem.length > 0 && i === 100) return; i++; const newID = uuidv4(); guildDb.customMessages.push({ @@ -827,10 +833,10 @@ const command: ChatInputCommand = { if (response.data.dare) { let i = guildDb.customMessages.filter( - (e) => e.type === "dare", + (e) => e.type === "dare" ).length; response.data.dare.map((d: any) => { - if (i === 100) return; + if (prem.length > 0 && i === 100) return; i++; const newID = uuidv4(); guildDb.customMessages.push({ @@ -843,10 +849,10 @@ const command: ChatInputCommand = { if (response.data.neverhaveiever) { let i = guildDb.customMessages.filter( - (e) => e.type === "neverhaveiever", + (e) => e.type === "neverhaveiever" ).length; response.data.neverhaveiever.map((d: any) => { - if (i === 100) return; + if (prem.length > 0 && i === 100) return; i++; const newID = uuidv4(); @@ -860,10 +866,10 @@ const command: ChatInputCommand = { if (response.data.wwyd) { let i = guildDb.customMessages.filter( - (e) => e.type === "wwyd", + (e) => e.type === "wwyd" ).length; response.data.wwyd.map((d: any) => { - if (i === 100) return; + if (prem.length > 0 && i === 100) return; i++; const newID = uuidv4(); @@ -881,7 +887,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: guildDb.customMessages, }, - true, + true ); if (all.length > 0) return; @@ -891,7 +897,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.success.import", + "wyCustom.success.import" ), }); return; @@ -899,7 +905,7 @@ const command: ChatInputCommand = { .catch((err) => { captureException(err); interaction.editReply( - `${client.translation.get(guildDb?.language, "wyCustom.error.import.att15")}\n\nError: ${err}`, + `${client.translation.get(guildDb?.language, "wyCustom.error.import.att15")}\n\nError: ${err}` ); return; }); @@ -911,7 +917,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.export.none", + "wyCustom.error.export.none" ), }); return; @@ -920,18 +926,18 @@ const command: ChatInputCommand = { await interaction.deferReply(); const wouldyourather = guildDb.customMessages.filter( - (c) => c.type === "wouldyourather", + (c) => c.type === "wouldyourather" ); const truth = guildDb.customMessages.filter( - (c) => c.type === "truth", + (c) => c.type === "truth" ); const dare = guildDb.customMessages.filter((c) => c.type === "dare"); const neverhaveiever = guildDb.customMessages.filter( - (c) => c.type === "neverhaveiever", + (c) => c.type === "neverhaveiever" ); const wwyd = guildDb.customMessages.filter((c) => c.type === "wwyd"); const topic = guildDb.customMessages.filter( - (c) => c.type === "topic", + (c) => c.type === "topic" ); let text = "{\n"; @@ -1004,7 +1010,7 @@ const command: ChatInputCommand = { interaction.editReply({ content: client.translation.get( guildDb?.language, - "wyCustom.success.export", + "wyCustom.success.export" ), files: [ { @@ -1021,7 +1027,7 @@ const command: ChatInputCommand = { .setColor("#F00505") .setTitle("Error!") .setDescription( - client.translation.get(guildDb?.language, "Language.embed.error"), + client.translation.get(guildDb?.language, "Language.embed.error") ); interaction .reply({ From 3ee40a204368d4d970159f59047995eaff9d1348 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:40:54 -0400 Subject: [PATCH 09/30] fix(custom import): make it not double text --- src/commands/settings/custom.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/commands/settings/custom.ts b/src/commands/settings/custom.ts index a52a51e2..bd538dda 100644 --- a/src/commands/settings/custom.ts +++ b/src/commands/settings/custom.ts @@ -751,16 +751,15 @@ const command: ChatInputCommand = { response.data[key].length > 100 ) { - for (const key in response.data) { - if (!response.data.hasOwnProperty(key)) continue; - if ( - guildDb.customMessages.filter((e) => e.type === key) - .length + - response.data[key].length > - 100 - ) - all.push(key); - } + + if (!response.data.hasOwnProperty(key)) continue; + if ( + guildDb.customMessages.filter((e) => e.type === key) + .length + + response.data[key].length > + 100 + ) + all.push(key); const premiumButton = new ActionRowBuilder().addComponents( From 5d8c95ecc643f8a669361406599cf79a347a03e8 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sun, 10 Aug 2025 15:04:44 -0400 Subject: [PATCH 10/30] feat(welcome description): made it allow longer strings & fix it's error msg --- src/util/Models/zod/welcomeEmbed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/Models/zod/welcomeEmbed.ts b/src/util/Models/zod/welcomeEmbed.ts index aea90f00..bfb0998c 100644 --- a/src/util/Models/zod/welcomeEmbed.ts +++ b/src/util/Models/zod/welcomeEmbed.ts @@ -10,7 +10,7 @@ const welcomeEmbedSchema = z.object({ description: z .string() .min(3, "Make sure your description is at least 3 characters long") - .max(350, "Make sure your description is only 150 characters long"), + .max(1000, "Make sure your description is only 1000 characters long"), author: z.object({ name: z .string() From 360eb7c092ef950eae84ea7ace556b7d7e944316 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 14:50:56 -0400 Subject: [PATCH 11/30] add: Custom Message Permission role --- src/buttons/miscellaneous/deleteCustomPerm.ts | 105 +++++++++++++++++ src/buttons/premium/webhookAvatar.ts | 36 ++++-- src/buttons/premium/webhookName.ts | 44 +++++--- .../selectionMenus/selectMenuCustomRole.ts | 106 ++++++++++++++++++ src/buttons/utilityInformation/classicMode.ts | 34 ++++-- src/buttons/utilityInformation/customPerm.ts | 40 +++++++ src/commands/settings/custom.ts | 20 +++- .../settings/settings-subcommands/utility.ts | 43 ++++--- src/languages/de_DE.json | 4 + src/languages/en_EN.json | 8 +- src/languages/es_ES.json | 6 +- src/languages/fr_FR.json | 6 +- src/languages/it_IT.json | 6 +- src/util/Models/guildModel.ts | 5 + 14 files changed, 399 insertions(+), 64 deletions(-) create mode 100644 src/buttons/miscellaneous/deleteCustomPerm.ts create mode 100644 src/buttons/selectionMenus/selectMenuCustomRole.ts create mode 100644 src/buttons/utilityInformation/customPerm.ts diff --git a/src/buttons/miscellaneous/deleteCustomPerm.ts b/src/buttons/miscellaneous/deleteCustomPerm.ts new file mode 100644 index 00000000..1c7f7933 --- /dev/null +++ b/src/buttons/miscellaneous/deleteCustomPerm.ts @@ -0,0 +1,105 @@ +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + EmbedBuilder, + type MessageActionRowComponentBuilder, +} from "discord.js"; +import type { Button } from "../../interfaces"; + +const button: Button = { + name: "deleteCustomPerm", + cooldown: false, + execute: async (interaction, client, guildDb) => { + const emb = new EmbedBuilder() + .setTitle( + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + ) + .setDescription( + `${client.translation.get( + guildDb?.language, + "Settings.embed.customPerm" + )}: :x:\n${client.translation.get( + guildDb?.language, + "Settings.embed.username" + )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.avatar" + )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.classicMode" + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` + ) + .setColor("#0598F6") + .setFooter({ + text: client.translation.get( + guildDb?.language, + "Settings.embed.footer" + ), + iconURL: client?.user?.displayAvatarURL() || undefined, + }); + + const button = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("webhookName") + .setEmoji("1185973660465500180") + .setLabel( + client.translation.get(guildDb?.language, "Settings.button.name") + ) + .setStyle(ButtonStyle.Success), + new ButtonBuilder() + .setCustomId("webhookAvatar") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get(guildDb?.language, "Settings.button.avatar") + ) + .setStyle( + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary + ) + ); + + const button2 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("classicMode") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.classicMode" + ) + ) + .setStyle( + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success + ), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle(ButtonStyle.Secondary) + ); + + await client.database.updateGuild(interaction.guild?.id || "", { + ...guildDb, + customPerm: null, + }); + + interaction.update({ + content: null, + embeds: [emb], + components: [button, button2], + options: { + ephemeral: true, + }, + }); + return; + }, +}; + +export default button; diff --git a/src/buttons/premium/webhookAvatar.ts b/src/buttons/premium/webhookAvatar.ts index 6116ce71..da21c407 100644 --- a/src/buttons/premium/webhookAvatar.ts +++ b/src/buttons/premium/webhookAvatar.ts @@ -56,28 +56,28 @@ const button: Button = { const emb = new EmbedBuilder() .setTitle( - client.translation.get( - guildDb?.language, - "Settings.embed.utilityTitle", - ), + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.username", + "Settings.embed.customPerm" + )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.username" )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar", + "Settings.embed.avatar" )}: [Image](<${value}>)\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode", - )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}`, + "Settings.embed.classicMode" + )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}` ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer", + "Settings.embed.footer" ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -110,12 +110,24 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode", - ), + "Settings.button.classicMode" + ) ) .setStyle( - guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary, + guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary ), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle( + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); async function getImageData() { diff --git a/src/buttons/premium/webhookName.ts b/src/buttons/premium/webhookName.ts index f32593b8..56007663 100644 --- a/src/buttons/premium/webhookName.ts +++ b/src/buttons/premium/webhookName.ts @@ -58,25 +58,25 @@ const button: Button = { const emb = new EmbedBuilder() .setTitle( - client.translation.get( - guildDb?.language, - "Settings.embed.utilityTitle", - ), + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") ) .setDescription( - `${client.translation.get(guildDb?.language, "Settings.embed.username")}: ${value}\n${client.translation.get( + `${client.translation.get( guildDb?.language, - "Settings.embed.avatar", + "Settings.embed.customPerm" + )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get(guildDb?.language, "Settings.embed.username")}: ${value}\n${client.translation.get( + guildDb?.language, + "Settings.embed.avatar" )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode", - )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}`, + "Settings.embed.classicMode" + )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}` ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer", + "Settings.embed.footer" ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -87,18 +87,18 @@ const button: Button = { .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name"), + client.translation.get(guildDb?.language, "Settings.button.name") ) .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar"), + client.translation.get(guildDb?.language, "Settings.button.avatar") ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, - ), + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); const button2 = @@ -109,12 +109,24 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode", - ), + "Settings.button.classicMode" + ) ) .setStyle( - guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary, + guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary ), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle( + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/selectionMenus/selectMenuCustomRole.ts b/src/buttons/selectionMenus/selectMenuCustomRole.ts new file mode 100644 index 00000000..b1cdf15e --- /dev/null +++ b/src/buttons/selectionMenus/selectMenuCustomRole.ts @@ -0,0 +1,106 @@ +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + EmbedBuilder, + type MessageActionRowComponentBuilder, +} from "discord.js"; +import type { Button } from "../../interfaces"; + +const button: Button = { + name: "selectMenuCustomRole", + cooldown: false, + execute: async (interaction: any, client, guildDb) => { + const newRole = interaction.values[0]; + const emb = new EmbedBuilder() + .setTitle( + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + ) + .setDescription( + `${client.translation.get( + guildDb?.language, + "Settings.embed.customPerm" + )}: <@&${newRole}>\n${client.translation.get( + guildDb?.language, + "Settings.embed.username" + )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.avatar" + )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.classicMode" + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` + ) + .setColor("#0598F6") + .setFooter({ + text: client.translation.get( + guildDb?.language, + "Settings.embed.footer" + ), + iconURL: client?.user?.displayAvatarURL() || undefined, + }); + + const button = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("webhookName") + .setEmoji("1185973660465500180") + .setLabel( + client.translation.get(guildDb?.language, "Settings.button.name") + ) + .setStyle(ButtonStyle.Success), + new ButtonBuilder() + .setCustomId("webhookAvatar") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get(guildDb?.language, "Settings.button.avatar") + ) + .setStyle( + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary + ) + ); + + const button2 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("classicMode") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.classicMode" + ) + ) + .setStyle( + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success + ), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle(ButtonStyle.Success) + ); + + await client.database.updateGuild(interaction.guild?.id || "", { + ...guildDb, + customPerm: newRole, + }); + + interaction.update({ + content: null, + embeds: [emb], + components: [button, button2], + options: { + ephemeral: true, + }, + }); + return; + }, +}; + +export default button; diff --git a/src/buttons/utilityInformation/classicMode.ts b/src/buttons/utilityInformation/classicMode.ts index 80540b5d..f41161f7 100644 --- a/src/buttons/utilityInformation/classicMode.ts +++ b/src/buttons/utilityInformation/classicMode.ts @@ -14,28 +14,28 @@ const button: Button = { const check = guildDb.classicMode; const emb = new EmbedBuilder() .setTitle( - client.translation.get( - guildDb?.language, - "Settings.embed.utilityTitle", - ), + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.username", + "Settings.embed.customPerm" + )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.username" )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar", + "Settings.embed.avatar" )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode", - )}: ${check ? ":x:" : ":white_check_mark:"}`, + "Settings.embed.classicMode" + )}: ${check ? ":x:" : ":white_check_mark:"}` ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer", + "Settings.embed.footer" ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -68,10 +68,22 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode", - ), + "Settings.button.classicMode" + ) ) .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle( + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/utilityInformation/customPerm.ts b/src/buttons/utilityInformation/customPerm.ts new file mode 100644 index 00000000..67a60987 --- /dev/null +++ b/src/buttons/utilityInformation/customPerm.ts @@ -0,0 +1,40 @@ +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + type MessageActionRowComponentBuilder, + RoleSelectMenuBuilder, +} from "discord.js"; +import type { Button } from "../../interfaces"; + +const button: Button = { + name: "customPerm", + cooldown: false, + execute: async (interaction, client, guildDb) => { + const inter = + new ActionRowBuilder().addComponents( + new RoleSelectMenuBuilder() + .setCustomId("selectMenuCustomRole") + .setPlaceholder("Select a role that can add custom messages.") + ); + + const inter2 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("deleteCustomPerm") + .setLabel("Delete Custom Permission Role") + .setStyle(ButtonStyle.Danger) + ); + + interaction.update({ + embeds: [], + content: client.translation.get(guildDb?.language, "Settings.customPerm"), + components: guildDb?.customPerm ? [inter, inter2] : [inter], + options: { + ephemeral: true, + }, + }); + }, +}; + +export default button; diff --git a/src/commands/settings/custom.ts b/src/commands/settings/custom.ts index bd538dda..97d73a12 100644 --- a/src/commands/settings/custom.ts +++ b/src/commands/settings/custom.ts @@ -109,9 +109,13 @@ const command: ChatInputCommand = { let generativeText: any; if ( - (interaction?.member?.permissions as Readonly).has( - PermissionFlagsBits.ManageGuild - ) + guildDb.customPerm + ? (interaction?.member?.roles as Readonly).cache.has( + guildDb.customPerm + ) + : ( + interaction?.member?.permissions as Readonly + ).has(PermissionFlagsBits.ManageGuild) ) { switch (interaction.options.getSubcommand()) { case "add": { @@ -751,7 +755,6 @@ const command: ChatInputCommand = { response.data[key].length > 100 ) { - if (!response.data.hasOwnProperty(key)) continue; if ( guildDb.customMessages.filter((e) => e.type === key) @@ -1022,11 +1025,18 @@ const command: ChatInputCommand = { } } } else { + console.log(guildDb.customPerm); const errorembed = new EmbedBuilder() .setColor("#F00505") .setTitle("Error!") .setDescription( - client.translation.get(guildDb?.language, "Language.embed.error") + guildDb.customPerm + ? client.translation.get( + guildDb?.language, + "Language.embed.errorRole", + { role: `<@&${guildDb.customPerm}>` } + ) + : client.translation.get(guildDb?.language, "Language.embed.error") ); interaction .reply({ diff --git a/src/commands/settings/settings-subcommands/utility.ts b/src/commands/settings/settings-subcommands/utility.ts index 01b17695..8ec87566 100644 --- a/src/commands/settings/settings-subcommands/utility.ts +++ b/src/commands/settings/settings-subcommands/utility.ts @@ -16,19 +16,22 @@ export default async function settingsGeneral( ) { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle"), + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.username", + "Settings.embed.customPerm" + )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.username" )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar", + "Settings.embed.avatar" )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode", - )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}`, + "Settings.embed.classicMode" + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` ) .setColor("#0598F6") .setFooter({ @@ -42,20 +45,18 @@ export default async function settingsGeneral( .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name"), + client.translation.get(guildDb?.language, "Settings.button.name") ) - .setStyle( - guildDb.webhookName ? ButtonStyle.Success : ButtonStyle.Secondary, - ), + .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar"), + client.translation.get(guildDb?.language, "Settings.button.avatar") ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, - ), + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); const button2 = @@ -66,12 +67,24 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode", - ), + "Settings.button.classicMode" + ) ) .setStyle( - guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary, + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success ), + new ButtonBuilder() + .setCustomId("customPerm") + .setEmoji("1256977616242606091") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.customPerm" + ) + ) + .setStyle( + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary + ) ); await interaction.reply({ diff --git a/src/languages/de_DE.json b/src/languages/de_DE.json index 00fff8a9..1c253ead 100644 --- a/src/languages/de_DE.json +++ b/src/languages/de_DE.json @@ -19,6 +19,7 @@ "Language": { "embed": { "error": "Dir fehlt die `ManageGuild` permission!", + "errorRole": "Sie müssen die Rolle **{role}** haben, um diesen Befehl zu benutzen!", "footer": "Would You" } }, @@ -247,6 +248,7 @@ "premium": "Um auf diese Funktion zuzugreifen, musst du ein [Would You Premium](https://wouldyoubot.gg/premium) Abo abschließen", "invalidLink": "Bitte gib einen gültigen PNG, JPG (JPEG), WEBP oder GIF Discord Anhang an, um ihn als Avatar des Bots festzulegen.", "daysSelection": "WƤhle jeden Tag aus, an dem du **nicht** mƶchtest, dass tƤgliche Nachrichten gesendet werden.", + "customPerm": "WƤhlen Sie eine Rolle aus, die für das Hinzufügen benutzerdefinierter Fragen verwendet werden soll.", "embed": { "welcomeMessage": "**Willkommensnachricht**", "generalTitle": "Would You - Generelle Einstellungen", @@ -298,6 +300,7 @@ "username": "<:crown:1256988872160710808> **QOTD Nutzername**", "avatar": "<:crown:1256988872160710808> **QOTD Profilbild**", "classicMode": "**Klassik Modus **", + "customPerm": "**Benutzerdefinierte Berechtigungsrolle**", "noChannel": "Keine spezifischen Kanaleinstellungen", "globalType": "**Globaler Fragentyp**:", "channelType": "**Einstellungen pro Kanal**:" @@ -361,6 +364,7 @@ "globalType": "Globalen Fragentyp setzen", "channelType": "Per-Channel-Typen konfigurieren", "setGlobal": "Klicke auf den Typ, den du global setzen mƶchten.", + "customPerm": "Benutzerdefinierte Berechtigungsrolle festlegen", "setChannel": "WƤhle einen Kanal aus, dem du einen Fragentyp hinzufügen mƶchten.", "typeRegex": "Du musst einen gültigen Typ angeben: `regular`, `custom` oder `mixed`." }, diff --git a/src/languages/en_EN.json b/src/languages/en_EN.json index a86997d9..0adcd654 100644 --- a/src/languages/en_EN.json +++ b/src/languages/en_EN.json @@ -18,7 +18,8 @@ }, "Language": { "embed": { - "error": "You are missing the `Manage Guild` permission to use this command!", + "error": "You are missing the `Manage Guild` permission to use this command.", + "errorRole": "You need to have the role **{role}** to use this command!", "footer": "Would You" } }, @@ -247,6 +248,7 @@ "premium": "To access this feature you will need to subscribe to [Would You Premium](https://wouldyoubot.gg/premium)", "invalidLink": "Please provide a valid PNG, JPG (JPEG), WEBP or GIF Discord attachment to set as the bot's avatar.", "daysSelection": "Select every day you **don't** want daily messages to be on.", + "customPerm": "Select a role that will be used for adding custom questions.", "embed": { "generalTitle": "Would You - General Settings", "utilityTitle": "Would You - Utility Settings", @@ -297,7 +299,8 @@ "error": "You are missing the `Manage Guild` permission to use this command!", "username": "<:crown:1256988872160710808> **QOTD Username**", "avatar": "<:crown:1256988872160710808> **QOTD Avatar**", - "classicMode": "**Classic Mode **", + "classicMode": "**Classic Mode**", + "customPerm": "**Custom Permission Role**", "noChannel": "No specific channel settings", "globalType": "**Global Question Type**:", "channelType": "**Per-Channel Settings**:" @@ -362,6 +365,7 @@ "channelType": "Configure Per-Channel Types", "setGlobal": "Click on the type you want to set globally.", "setChannel": "Select a channel you want to add a question type to.", + "customPerm": "Set Custom Permission Role", "typeRegex": "You must provide a valid type: `regular`, `custom`, or `mixed`." }, "modal": { diff --git a/src/languages/es_ES.json b/src/languages/es_ES.json index 77d846fa..31fee0f6 100644 --- a/src/languages/es_ES.json +++ b/src/languages/es_ES.json @@ -19,6 +19,7 @@ "Language": { "embed": { "error": "Ā”Te falta el permiso `Manage guild` para usar este comando!", + "errorRole": "Ā”Necesitas tener el rol **{role}** para usar este comando!", "footer": "Would You" } }, @@ -247,6 +248,7 @@ "premium": "Para acceder a esta función deberĆ” suscribirse a [Would You Premium](https://wouldyoubot.gg/premium)", "invalidLink": "Proporciona un archivo adjunto vĆ”lido PNG, JPG (JPEG), WEBP o GIF de Discord para establecerlo como avatar del bot.", "daysSelection": "Seleccione todos los dĆ­as en los que **no** desea que aparezcan los mensajes diarios.", + "customPerm": "Seleccione el rol que se utilizarĆ” para aƱadir preguntas personalizadas.", "embed": { "welcomeMessage": "**Mensaje de bienvenida**", "generalTitle": "Would You - Configuración general", @@ -294,7 +296,8 @@ "error": "Ā”Te falta el permiso `Manage guild` para usar este comando!", "username": "<:crown:1256988872160710808> **QOTD Username**", "avatar": "<:crown:1256988872160710808> **QOTD Avatar**", - "classicMode": "**Modo ClĆ”sico**" + "classicMode": "**Modo ClĆ”sico**", + "customPerm": "**Rol de permiso personalizado**" }, "button": { "welcomeMessage": "Editar el mensaje de bienvenida", @@ -351,6 +354,7 @@ "welcomeEmbedTimestampMenu": "Borrar marca de tiempo", "avatar": "Establecer avatar", "name": "Establecer nombre de usuario", + "customPerm": "Establecer función de permisos personalizada", "classicMode": "Activar el modo clĆ”sico" }, "modal": { diff --git a/src/languages/fr_FR.json b/src/languages/fr_FR.json index ed775fd3..7df342f0 100644 --- a/src/languages/fr_FR.json +++ b/src/languages/fr_FR.json @@ -19,6 +19,7 @@ "Language": { "embed": { "error": "Vous avez besoin de la permission `GĆ©rer le serveur` pour utiliser cette commande !", + "errorRole": "Vous devez avoir le rĆ“le **{role}** pour utiliser cette commande !", "footer": "Would You" } }, @@ -247,6 +248,7 @@ "premium": "Pour accĆ©der Ć  cette fonctionnalitĆ©, vous devrez vous abonner Ć  [Would You Premium](https://wouldyoubot.gg/premium)", "invalidLink": "Veuillez fournir une piĆØce jointe Discord valide PNG, JPG (JPEG), WEBP ou GIF Ć  dĆ©finir comme avatar du bot.", "daysSelection": "SĆ©lectionnez chaque jour que vous **ne voulez pas** que les messages quotidiens soient allumĆ©s.", + "customPerm": "SĆ©lectionnez un rĆ“le qui sera utilisĆ© pour ajouter des questions personnalisĆ©es.", "embed": { "welcomeMessage": "**Message de bienvenue**", "generalTitle": "Would You - ParamĆØtres gĆ©nĆ©raux", @@ -294,7 +296,8 @@ "error": "Vous avez besoin de la permission `GĆ©rer le serveur` pour utiliser cette commande!", "username": "<:crown:1256988872160710808> **Nom d'utilisateur QOTD**", "avatar": "<:crown:1256988872160710808> **Avatar QOTD**", - "classicMode": "**Mode classique**" + "classicMode": "**Mode classique**", + "customPerm": "**RĆ“le de permission personnalisĆ©**" }, "button": { "welcomeMessage": "Modifier le message de bienvenue", @@ -351,6 +354,7 @@ "welcomeEmbed": "Retour", "avatar": "DĆ©finir l'avatar", "name": "DĆ©finir le nom d'utilisateur", + "customPerm": "DĆ©finir un rĆ“le d'autorisation personnalisĆ©", "classicMode": "Activer/dĆ©sactiver le mode classique" }, "modal": { diff --git a/src/languages/it_IT.json b/src/languages/it_IT.json index 896833ca..4e7c320a 100644 --- a/src/languages/it_IT.json +++ b/src/languages/it_IT.json @@ -19,6 +19,7 @@ "Language": { "embed": { "error": "Hai bisogno del permesso `Gestire Server` per usare questo comando!", + "errorRole": "Per utilizzare questo comando ĆØ necessario avere il ruolo **{role}**!", "footer": "Would You" } }, @@ -247,6 +248,7 @@ "premium": "Per accedere a questa funzionalitĆ  dovrai iscriverti a [Would You Premium](https://wouldyoubot.gg/premium)", "invalidLink": "Fornisci un valido allegato PNG, JPG (JPEG), WEBP o GIF Discord da impostare come avatar del bot.", "daysSelection": "Seleziona ogni giorno che **non** vuoi che i messaggi giornalieri siano attivi.", + "customPerm": "Selezionare un ruolo da utilizzare per l'aggiunta di domande personalizzate.", "embed": { "welcomeMessage": "**Messaggio di benvenuto**", "generalTitle": "Would You - Impostazioni generali", @@ -294,7 +296,8 @@ "error": "Hai bisogno del permesso `Gestire Server` per usare questo comando!", "username": "<:crown:1256988872160710808> **Nome Utente QOTD**", "avatar": "<:crown:1256988872160710808> **QOTD Avatar**", - "classicMode": "**ModalitĆ  classica **" + "classicMode": "**ModalitĆ  classica **", + "customPerm": "**Ruolo di autorizzazione personalizzato**" }, "button": { "welcomeMessage": "Modifica del messaggio di benvenuto", @@ -351,6 +354,7 @@ "welcomeEmbedTimestampMenu": "Cancellare il timestamp", "avatar": "Imposta Avatar", "name": "Imposta Nome Utente", + "customPerm": "Impostare il ruolo di autorizzazione personalizzato", "classicMode": "Alterna la modalitĆ  classica" }, "modal": { diff --git a/src/util/Models/guildModel.ts b/src/util/Models/guildModel.ts index 03b436ee..3c4c800c 100644 --- a/src/util/Models/guildModel.ts +++ b/src/util/Models/guildModel.ts @@ -66,6 +66,7 @@ export interface IGuildModel { commandCooldown: number; commandBy: string; commandType: string; + customPerm: string | null; } const guildProfileSchema = new Schema( @@ -285,6 +286,10 @@ const guildProfileSchema = new Schema( type: String, default: "Command", }, + customPerm: { + type: String, + default: null, + } }, { timestamps: true } ); From c42676460c69f5dc3b5388ff2404b6d34134fcbb Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 15:47:03 -0400 Subject: [PATCH 12/30] fix: custom permissions --- src/commands/settings/custom.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/settings/custom.ts b/src/commands/settings/custom.ts index 97d73a12..f16338ce 100644 --- a/src/commands/settings/custom.ts +++ b/src/commands/settings/custom.ts @@ -27,7 +27,6 @@ const command: ChatInputCommand = { .setDescription("Lets you manage your own questions") .setContexts([0]) .setIntegrationTypes([0]) - .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild) .setDescriptionLocalizations({ de: "Fügt eigene WouldYou Fragen hinzu", "es-ES": "AƱade mensajes Would You personalizados", From a658f33b5255e3ddc95b2cad033ffcba870b486e Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:17:00 -0400 Subject: [PATCH 13/30] Update info command to look a little better --- src/commands/utility/info.ts | 85 +++++++++++++++++------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index 84b1646a..42cf2ee9 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -1,7 +1,10 @@ import { captureException } from "@sentry/node"; import { EmbedBuilder, SlashCommandBuilder } from "discord.js"; import type { ChatInputCommand } from "../../interfaces"; -const { version } = require("../../../package.json"); +import { + type IShardClusterStore, + shardClusterStoreModel, +} from "../../util/Models/ShardClusterStore"; const command: ChatInputCommand = { requireGuild: true, @@ -20,12 +23,13 @@ const command: ChatInputCommand = { execute: async (interaction, client, guildDb) => { const serverCount = await client.cluster.broadcastEval( - (c) => c.guilds.cache.size, + (c) => c.guilds.cache.size ); const userCount = await client.cluster.broadcastEval((c) => - c.guilds.cache.reduce((a, b) => a + b.memberCount, 0), + c.guilds.cache.reduce((a, b) => a + b.memberCount, 0) ); + const ramUsage = await client.cluster.broadcastEval(() => { function round(num: number) { const m = Number((Math.abs(num) * 100).toPrecision(15)); @@ -40,54 +44,45 @@ const command: ChatInputCommand = { const premium = await client.premium.check(interaction.guildId); - const premiumEmoji = premium.result ? "āœ…" : "āŒ"; + const { dominik, sky, skelly, paulos, tee, woofer } = + client.config.emojis.info; - const { dominik, sky, skelly, paulos, tee, woofer } = client.config.emojis.info; + // make it so it uses shardClusterStoreModel and displays them in a box where it shows the shard, shard master, and cluster number const infoEmbed = new EmbedBuilder() .setColor("#0598F6") - .setTitle("Bot Info") - .addFields( - { - name: "Developers:", - value: `${dominik + sky + skelly + paulos + tee + woofer}`, - inline: false, - }, - { - name: "Servercount:", - value: `${serverCount.reduce((prev, val) => prev + val, 0).toLocaleString()}`, - inline: false, - }, - { - name: "Users:", - value: `${userCount.reduce((a, b) => a + b, 0).toLocaleString()}`, - inline: false, - }, - { - name: "Memory:", - value: `${ramUsage.reduce((acc, usage) => acc + usage, 0).toLocaleString()}GB`, - inline: false, - }, - { - name: "Last Restart:", - value: ` - `, - inline: false, - }, - { - name: "Bot Version:", - value: `v${version}`, - inline: false, - }, - { - name: "Premium Server:", - value: `${`${premiumEmoji} ${premium.result}`}`, - inline: false, - }, + .setDescription( + `# Info about Would You +- Devs: ${dominik + sky + skelly + paulos + tee + woofer} +- Servers: ${serverCount.reduce((prev, val) => prev + val, 0).toLocaleString()} +- Users: ${userCount.reduce((a, b) => a + b, 0).toLocaleString()} +- Memory: ${ramUsage.reduce((acc, usage) => acc + usage, 0).toLocaleString()}GB +- Last Restart: + +## Shard Information +\`\`\`ini +${await shardClusterStoreModel + .find() + .then((shards: IShardClusterStore[]) => + shards + .map( + (s) => + `[Shard ${s.shard}] Cluster: ${s.cluster} | Master: ${s.isMaster}` + ) + .join("\n") + ) + .catch(() => "No Shard Data found")} +\`\`\` + +-# [Support Server](https://wouldyoubot.gg/discord) +-# [Website](https://wouldyoubot.gg) +-# [Invite Link](https://wouldyoubot.gg/invite) +-# [Privacy Policy](https://wouldyoubot.gg/privacy) +-# [Terms of Service](https://wouldyoubot.gg/terms) +-# [Legal](https://wouldyoubot.gg/legal)` ) - .setThumbnail("https://wouldyoubot.gg/Logo.png") .setFooter({ - text: `${interaction.user.tag} | Shard #${interaction?.guild?.shardId} | Cluster #${client.cluster.id}`, + text: `Premium Status: ${premium.result ? premium.rawType : "Free"}`, iconURL: "https://wouldyoubot.gg/Logo.png", }); From 18279627d26c7073497ecb82ebab9bfdafc11052 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:49:15 -0400 Subject: [PATCH 14/30] Made info better --- src/commands/utility/info.ts | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index 42cf2ee9..bba83040 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -47,33 +47,40 @@ const command: ChatInputCommand = { const { dominik, sky, skelly, paulos, tee, woofer } = client.config.emojis.info; - // make it so it uses shardClusterStoreModel and displays them in a box where it shows the shard, shard master, and cluster number - + // change the shard information so it displays Each cluster and lists the shards in that cluster but make it so it doesn't take up much space + // Property 'totalClusters' does not exist on type 'ClusterClient>'. const infoEmbed = new EmbedBuilder() .setColor("#0598F6") .setDescription( `# Info about Would You -- Devs: ${dominik + sky + skelly + paulos + tee + woofer} -- Servers: ${serverCount.reduce((prev, val) => prev + val, 0).toLocaleString()} -- Users: ${userCount.reduce((a, b) => a + b, 0).toLocaleString()} -- Memory: ${ramUsage.reduce((acc, usage) => acc + usage, 0).toLocaleString()}GB -- Last Restart: - +Devs: ${dominik + sky + skelly + paulos + tee + woofer} +Servers: ${serverCount.reduce((prev, val) => prev + val, 0).toLocaleString()} +Users: ${userCount.reduce((a, b) => a + b, 0).toLocaleString()} +Memory: ${ramUsage.reduce((acc, usage) => acc + usage, 0).toLocaleString()}GB +Last Restart: ## Shard Information \`\`\`ini ${await shardClusterStoreModel .find() .then((shards: IShardClusterStore[]) => - shards - .map( - (s) => - `[Shard ${s.shard}] Cluster: ${s.cluster} | Master: ${s.isMaster}` - ) - .join("\n") + shards.reduce((acc, shard) => { + const clusters = new Map(); + shards.forEach((s) => { + if (!clusters.has(s.cluster)) clusters.set(s.cluster, []); + clusters.get(s.cluster)?.push(s); + }); + + return Array.from(clusters.entries()) + .map(([clusterId, clusterShards]) => { + const shardList = clusterShards.map((s) => s.shard).join(", "); + return `[Cluster ${clusterId}] | Shards: ${shardList}`; + }) + .join("\n"); + }, "") ) .catch(() => "No Shard Data found")} \`\`\` - +## Useful Links -# [Support Server](https://wouldyoubot.gg/discord) -# [Website](https://wouldyoubot.gg) -# [Invite Link](https://wouldyoubot.gg/invite) From c5937de60d71bb7349c513edad09b4be6ccb919e Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:49:37 -0400 Subject: [PATCH 15/30] Made info better --- src/commands/utility/info.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index bba83040..39e4e789 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -47,8 +47,6 @@ const command: ChatInputCommand = { const { dominik, sky, skelly, paulos, tee, woofer } = client.config.emojis.info; - // change the shard information so it displays Each cluster and lists the shards in that cluster but make it so it doesn't take up much space - // Property 'totalClusters' does not exist on type 'ClusterClient>'. const infoEmbed = new EmbedBuilder() .setColor("#0598F6") .setDescription( From 38addbe193992f4b97d18b882593dd93a0d20595 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:56:57 -0400 Subject: [PATCH 16/30] Okay last info update --- src/commands/utility/info.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index 39e4e789..588ea8bf 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -70,15 +70,27 @@ ${await shardClusterStoreModel return Array.from(clusters.entries()) .map(([clusterId, clusterShards]) => { - const shardList = clusterShards.map((s) => s.shard).join(", "); - return `[Cluster ${clusterId}] | Shards: ${shardList}`; + const sortedShards = clusterShards + .map((s) => s.shard) + .sort((a, b) => a - b); + const shardGroups = sortedShards.reduce( + (groups: string[], shard, i) => { + const groupIndex = Math.floor(i / 8); + if (!groups[groupIndex]) groups[groupIndex] = ""; + groups[groupIndex] += (groups[groupIndex] ? ", " : "") + shard; + return groups; + }, + [] + ); + + return `[Cluster ${clusterId}]\n${shardGroups.join("\n ")}`; }) - .join("\n"); + .join("\n\n"); }, "") ) .catch(() => "No Shard Data found")} \`\`\` -## Useful Links +### Useful Links -# [Support Server](https://wouldyoubot.gg/discord) -# [Website](https://wouldyoubot.gg) -# [Invite Link](https://wouldyoubot.gg/invite) From e318d14bfbe2393ef3a36267c0b21ac219bb5455 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:16:44 -0400 Subject: [PATCH 17/30] Okay THIS is the last update :) --- src/commands/utility/info.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index 588ea8bf..d7543d19 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -83,7 +83,7 @@ ${await shardClusterStoreModel [] ); - return `[Cluster ${clusterId}]\n${shardGroups.join("\n ")}`; + return `[Cluster ${clusterId}]\n${shardGroups.join("\n")}`; }) .join("\n\n"); }, "") From 9bf95741a0788d3180dee573bdbf1072aa15fd87 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sat, 11 Oct 2025 03:36:01 -0400 Subject: [PATCH 18/30] Testing new DMS --- src/util/wouldYou.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/wouldYou.ts b/src/util/wouldYou.ts index db9fb6b6..bc0e61b4 100644 --- a/src/util/wouldYou.ts +++ b/src/util/wouldYou.ts @@ -133,8 +133,8 @@ export default class WouldYou extends Client { this.keepAlive.start(); // Daily Message - this.dailyMessage = new DailyMessage(this); - this.dailyMessage.listen(); + // this.dailyMessage = new DailyMessage(this); + // this.dailyMessage.listen(); this.voting = new Voting(this); From 671db7eb1dd07beeba88cc84664419b08dff8096 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sat, 11 Oct 2025 04:54:32 -0400 Subject: [PATCH 19/30] Turn DMS back on --- src/util/wouldYou.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/wouldYou.ts b/src/util/wouldYou.ts index bc0e61b4..db9fb6b6 100644 --- a/src/util/wouldYou.ts +++ b/src/util/wouldYou.ts @@ -133,8 +133,8 @@ export default class WouldYou extends Client { this.keepAlive.start(); // Daily Message - // this.dailyMessage = new DailyMessage(this); - // this.dailyMessage.listen(); + this.dailyMessage = new DailyMessage(this); + this.dailyMessage.listen(); this.voting = new Voting(this); From 6b19f3181222ba46746b029843fbeb055baf0e4c Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sat, 11 Oct 2025 13:20:19 -0400 Subject: [PATCH 20/30] Turning DMS off for testing --- src/util/wouldYou.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/wouldYou.ts b/src/util/wouldYou.ts index db9fb6b6..bc0e61b4 100644 --- a/src/util/wouldYou.ts +++ b/src/util/wouldYou.ts @@ -133,8 +133,8 @@ export default class WouldYou extends Client { this.keepAlive.start(); // Daily Message - this.dailyMessage = new DailyMessage(this); - this.dailyMessage.listen(); + // this.dailyMessage = new DailyMessage(this); + // this.dailyMessage.listen(); this.voting = new Voting(this); From 535143cb79bc63c44c49089537aefcb3657e0b36 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sun, 12 Oct 2025 16:59:06 -0400 Subject: [PATCH 21/30] add: dmsError for fixing Daily Message errors --- src/commands/index.ts | 36 +++++++++++++++++++++++++++-------- src/util/Models/guildModel.ts | 7 ++++++- src/util/wouldYou.ts | 2 +- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index faff34a7..8a942c54 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -21,7 +21,7 @@ const commandInteractionEvent: Event = { if (interaction.isCommand()) { console.log( - `[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.username}) COMMAND ${interaction.commandName}`, + `[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.username}) COMMAND ${interaction.commandName}` ); const command = client.commands.get(interaction.commandName); @@ -30,7 +30,7 @@ const commandInteractionEvent: Event = { if (interaction.guildId !== null) { guildDb = await client.database.getGuild( interaction.guildId as string, - true, + true ); client.database .updateGuild(interaction.guildId as string, { @@ -55,24 +55,24 @@ const commandInteractionEvent: Event = { if (guildDb.commandType == "Command") { cooldownKey = `${interaction.guild?.id}-${interaction.commandName}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 ); } else if (guildDb.commandType == "User") { cooldownKey = `${interaction.guild?.id}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 ); } } else if (guildDb?.commandBy == "User") { if (guildDb.commandType == "Command") { cooldownKey = `${interaction.user?.id}-${interaction.commandName}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 ); } else if (guildDb.commandType == "User") { cooldownKey = `${interaction.guild?.id}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 ); } } @@ -113,7 +113,7 @@ const commandInteractionEvent: Event = { // Increment the specified field using $inc await UserModel.updateOne( { userID: interaction.user?.id }, // Specify the query to find the user - { $inc: { [fieldPath]: 1 } }, // Use computed fieldPath + { $inc: { [fieldPath]: 1 } } // Use computed fieldPath ); } @@ -147,8 +147,28 @@ const commandInteractionEvent: Event = { .execute( interaction as ChatInputCommandInteraction, client, - guildDb as IGuildModel, + guildDb as IGuildModel ) + .then(async () => { + const repliedMessage = await interaction.fetchReply(); + + if (guildDb && guildDb?.dmsError) { + await repliedMessage + .reply({ + embeds: [ + { + title: + "Hello, sorry to bother you, but Would You encountered an error in its Daily Message system.", + description: `The error is as follows:\n${guildDb?.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.`, + color: 0xffcc00, + }, + ], + }) + .catch(() => {}); + + client.database.updateGuild(guildDb.guildID, { dmsError: null }); + } + }) .catch((err: Error) => { captureException(err); return interaction.reply({ diff --git a/src/util/Models/guildModel.ts b/src/util/Models/guildModel.ts index 3c4c800c..21c595ed 100644 --- a/src/util/Models/guildModel.ts +++ b/src/util/Models/guildModel.ts @@ -67,6 +67,7 @@ export interface IGuildModel { commandBy: string; commandType: string; customPerm: string | null; + dmsError?: string | null; } const guildProfileSchema = new Schema( @@ -289,7 +290,11 @@ const guildProfileSchema = new Schema( customPerm: { type: String, default: null, - } + }, + dmsError: { + type: String, + default: null, + }, }, { timestamps: true } ); diff --git a/src/util/wouldYou.ts b/src/util/wouldYou.ts index bc0e61b4..3f8adb1f 100644 --- a/src/util/wouldYou.ts +++ b/src/util/wouldYou.ts @@ -132,7 +132,7 @@ export default class WouldYou extends Client { this.keepAlive = new KeepAlive(this); this.keepAlive.start(); - // Daily Message + // Daily Message - Turned off as DMS runs by itself now // this.dailyMessage = new DailyMessage(this); // this.dailyMessage.listen(); From 03da48882c6616f7e4b697d8932a9f604520bd28 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro <47897305+forgetfulskybro@users.noreply.github.com> Date: Sun, 12 Oct 2025 18:30:00 -0400 Subject: [PATCH 22/30] dmsError not sending ig --- src/commands/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index 8a942c54..61f08fe7 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -150,16 +150,15 @@ const commandInteractionEvent: Event = { guildDb as IGuildModel ) .then(async () => { - const repliedMessage = await interaction.fetchReply(); - if (guildDb && guildDb?.dmsError) { + const repliedMessage = await interaction.fetchReply(); await repliedMessage .reply({ embeds: [ { title: "Hello, sorry to bother you, but Would You encountered an error in its Daily Message system.", - description: `The error is as follows:\n${guildDb?.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.`, + description: `The error is as follows:\n${guildDb.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.`, color: 0xffcc00, }, ], From e74c1e692508ceb7d37765da8f1d92ca7c9f6c36 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Mon, 13 Oct 2025 09:50:14 -0400 Subject: [PATCH 23/30] Fix translations --- src/languages/de_DE.json | 2 +- src/languages/en_EN.json | 2 +- src/languages/es_ES.json | 2 +- src/languages/fr_FR.json | 2 +- src/languages/it_IT.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/languages/de_DE.json b/src/languages/de_DE.json index 1c253ead..adf9deaa 100644 --- a/src/languages/de_DE.json +++ b/src/languages/de_DE.json @@ -226,7 +226,7 @@ }, "Settings": { "errorSame": "Die gegebene Zeitzone ist die gleiche Zeitzone, die schon gesetzt ist. Stelle sicher, dass du eine andere Zeitzone wƤhlst.", - "errorInvalid": "Die gegebene Zeitzone ist ungültig, du kannst eine gültige Zeitzone von diesen auswƤhlen [ZeitzonenwƤhler](https://kevinnovak.github.io/Time-Zone-Picker/)", + "errorInvalid": "Die gegebene Zeitzone ist ungültig, du kannst eine gültige Zeitzone von diesen auswƤhlen [ZeitzonenwƤhler](https://zones.arilyn.cc/)", "intervalSame": "Die angegebene Verƶffentlichungszeit ist die gleiche wie die bereits gesetzte. Stelle sicher, dass du einen andere Verƶffentlichungszeit wƤhlst.", "intervalInvalid": "Die angegebene Verƶffentlichungszeit war ungültig. Stelle sicher, dass deine Verƶffentlichungszeit im 24h-Format ist und entweder mit 00 oder einem 5-Minuten-Intervall endet!", "dailyChannel": "WƤhle einen Kanal, in dem du tƤgliche Nachrichten haben mƶchtest!", diff --git a/src/languages/en_EN.json b/src/languages/en_EN.json index 0adcd654..05fe04ae 100644 --- a/src/languages/en_EN.json +++ b/src/languages/en_EN.json @@ -226,7 +226,7 @@ }, "Settings": { "errorSame": "The provided timezone is the same timezone that is already set. Make sure to choose a different timezone.", - "errorInvalid": "Provided timezone was invalid, you can pick a valid timezone from this [Time Zone Picker](https://kevinnovak.github.io/Time-Zone-Picker/)", + "errorInvalid": "Provided timezone was invalid, you can pick a valid timezone from this [Time Zone Picker](https://zones.arilyn.cc/)", "intervalSame": "The provided post time is the same post time that is already set. Make sure to choose a different post time.", "intervalInvalid": "The provided post time was invalid. Make sure your post time is in the 24h format and minutes are either 00 or an interval of 5!", "dailyChannel": "Select a channel where you want Daily Messages to be!", diff --git a/src/languages/es_ES.json b/src/languages/es_ES.json index 31fee0f6..3ed52245 100644 --- a/src/languages/es_ES.json +++ b/src/languages/es_ES.json @@ -226,7 +226,7 @@ }, "Settings": { "errorSame": "La zona horaria proporcionada es la misma zona horaria que ya estĆ” definida. AsegĆŗrese de elegir una zona horaria diferente.", - "errorInvalid": "La zona horaria proporcionada no es vĆ”lida, puedes elegir una zona horaria vĆ”lida aquĆ­: [Selector de Zona Horaria](https://kevinnovak.github.io/Time-Zone-Picker/)", + "errorInvalid": "La zona horaria proporcionada no es vĆ”lida, puedes elegir una zona horaria vĆ”lida aquĆ­: [Selector de Zona Horaria](https://zones.arilyn.cc/)", "intervalSame": "La hora de publicación especificada es la misma que la ya establecida. AsegĆŗrese de elegir una hora de publicación diferente.", "intervalInvalid": "La hora del mensaje no es vĆ”lida. Ā”AsegĆŗrese de que la hora del mensaje estĆ” en formato de 24 horas y de que los minutos son 00 o un intervalo de 5!", "dailyChannel": "Ā”Selecciona un canal donde quieres que sean enviados los Mensajes Diarios!", diff --git a/src/languages/fr_FR.json b/src/languages/fr_FR.json index 7df342f0..747c85d0 100644 --- a/src/languages/fr_FR.json +++ b/src/languages/fr_FR.json @@ -226,7 +226,7 @@ }, "Settings": { "errorSame": "Le fuseau horaire fourni est le mĆŖme fuseau horaire que celui dĆ©jĆ  dĆ©fini. Assurez-vous de choisir un autre fuseau horaire.", - "errorInvalid": "Le fuseau horaire fourni est invalide, vous pouvez choisir un fuseau horaire valide sur ce [sĆ©lecteur de fuseau horaire](https://kevinnovak.github.io/Time-Zone-Picker/)", + "errorInvalid": "Le fuseau horaire fourni est invalide, vous pouvez choisir un fuseau horaire valide sur ce [sĆ©lecteur de fuseau horaire](https://zones.arilyn.cc/)", "intervalSame": "L'heure de publication indiquĆ©e est la mĆŖme que celle dĆ©jĆ  dĆ©finie. Assure-toi de choisir une autre heure de publication.", "intervalInvalid": "L'heure de publication fournie n'est pas valide. Assure-toi que ton heure d'envoi est au format 24h et que les minutes sont soit 00, soit un multiple de 5 !", "dailyChannel": "SĆ©lectionnez le channel où vous voulez que les messages quotidiens soient postĆ©s !", diff --git a/src/languages/it_IT.json b/src/languages/it_IT.json index 4e7c320a..b25b0fbe 100644 --- a/src/languages/it_IT.json +++ b/src/languages/it_IT.json @@ -226,7 +226,7 @@ }, "Settings": { "errorSame": "Il fuso orario selezionato ĆØ lo stesso giĆ  impostato. Assicurati di scegliere un fuso orario diverso.", - "errorInvalid": "Il fuso orario fornito non ĆØ valido, puoi sceglierne uno da questa [Lista di Fusi Orari](https://kevinnovak.github.io/Time-Zone-Picker/)", + "errorInvalid": "Il fuso orario fornito non ĆØ valido, puoi sceglierne uno da questa [Lista di Fusi Orari](https://zones.arilyn.cc/)", "intervalSame": "L'orario di pubblicazione selezionato ĆØ lo stesso giĆ  impostato. Assicurati di scegliere un orario diverso.", "intervalInvalid": "L'orario del messaggio fornito non ĆØ valido. Assicurati che l'ora di invio sia nel formato 24h e che i minuti siano 00 o un intervallo di 5!", "dailyChannel": "Seleziona il canale dove vuoi che vengano inviati i Messaggi Giornalieri!", From 94fcc9f4a18299862349c54955eec80b57617d42 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Mon, 13 Oct 2025 13:23:15 -0400 Subject: [PATCH 24/30] Testing dmsError --- src/commands/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index 61f08fe7..a955c98d 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -150,7 +150,9 @@ const commandInteractionEvent: Event = { guildDb as IGuildModel ) .then(async () => { + console.warn(`[INFO] dmsError: ${guildDb?.dmsError}`); if (guildDb && guildDb?.dmsError) { + console.warn("[WARNING] Sending dmsError message"); const repliedMessage = await interaction.fetchReply(); await repliedMessage .reply({ @@ -163,7 +165,7 @@ const commandInteractionEvent: Event = { }, ], }) - .catch(() => {}); + .catch((e: any) => console.warn(e)); client.database.updateGuild(guildDb.guildID, { dmsError: null }); } From 0b028923b7616ee1cfb2045dd0866c53d7f896cf Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Mon, 13 Oct 2025 13:41:58 -0400 Subject: [PATCH 25/30] Okay I figured out why dmsError didn't work for me :) --- src/commands/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index a955c98d..c9ca6fec 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -150,9 +150,7 @@ const commandInteractionEvent: Event = { guildDb as IGuildModel ) .then(async () => { - console.warn(`[INFO] dmsError: ${guildDb?.dmsError}`); if (guildDb && guildDb?.dmsError) { - console.warn("[WARNING] Sending dmsError message"); const repliedMessage = await interaction.fetchReply(); await repliedMessage .reply({ @@ -160,12 +158,12 @@ const commandInteractionEvent: Event = { { title: "Hello, sorry to bother you, but Would You encountered an error in its Daily Message system.", - description: `The error is as follows:\n${guildDb.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.`, + description: `The error is as follows:\n${guildDb.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.\n**Support Server**: [Click Here](https://discord.gg/vMyXAxEznS)**`, color: 0xffcc00, }, ], }) - .catch((e: any) => console.warn(e)); + .catch(() => {}); client.database.updateGuild(guildDb.guildID, { dmsError: null }); } From 291c7bf8ab1fe92c436b9e7e270e7ab4a8d9899e Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Wed, 22 Oct 2025 22:58:36 -0400 Subject: [PATCH 26/30] fix: make WY not respond to bots =) --- src/commands/index.ts | 2 +- src/events/messageCreate.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index c9ca6fec..8a91c52e 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -163,7 +163,7 @@ const commandInteractionEvent: Event = { }, ], }) - .catch(() => {}); + .catch(() => {}); client.database.updateGuild(guildDb.guildID, { dmsError: null }); } diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 243d4a70..cb6b7c77 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -16,6 +16,7 @@ const event: Event = { event: "messageCreate", execute: async (client: WouldYou, message: Message) => { // Always check the permissions before doing any actions to avoid a ratelimit IP ban =) + if (message?.member?.user.bot) return; if ( message.guild?.members.me && (message?.channel as GuildTextBasedChannel) From cbbe791817bdded0e45a2f02f5d9383649c487ec Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Wed, 22 Oct 2025 23:09:02 -0400 Subject: [PATCH 27/30] Turn off messageCreate for now --- src/events/messageCreate.ts | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index cb6b7c77..4f46edae 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -56,26 +56,26 @@ const event: Event = { .setURL("https://discord.gg/vMyXAxEznS"), ); - Cooldown.add(message?.channel?.id); - setTimeout(() => { - Cooldown.delete(message?.channel?.id); - }, 10000); + // Cooldown.add(message?.channel?.id); + // setTimeout(() => { + // Cooldown.delete(message?.channel?.id); + // }, 10000); - if ( - message.content && - new RegExp(`^(<@!?${client?.user?.id}>)`).test(message.content) - ) - if (message.inGuild()) { - message.channel - .send({ - embeds: [embed], - components: [supportbutton], - }) - .catch((err: Error) => { - captureException(err); - }); - } - return; + // if ( + // message.content && + // new RegExp(`^(<@!?${client?.user?.id}>)`).test(message.content) + // ) + // if (message.inGuild()) { + // message.channel + // .send({ + // embeds: [embed], + // components: [supportbutton], + // }) + // .catch((err: Error) => { + // captureException(err); + // }); + // } + // return; } }, }; From 15ec449d14e5a23ec7d4fc6c637dff1f2f2a5948 Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Sun, 9 Nov 2025 11:41:19 -0500 Subject: [PATCH 28/30] Remove unneeded markdown --- src/commands/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/index.ts b/src/commands/index.ts index 8a91c52e..2316e736 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -158,7 +158,7 @@ const commandInteractionEvent: Event = { { title: "Hello, sorry to bother you, but Would You encountered an error in its Daily Message system.", - description: `The error is as follows:\n${guildDb.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.\n**Support Server**: [Click Here](https://discord.gg/vMyXAxEznS)**`, + description: `The error is as follows:\n${guildDb.dmsError}\n\nIf you aren't an administrator for this server, please contact them and send them this message for them to fix.\n**Support Server**: https://discord.gg/vMyXAxEznS`, color: 0xffcc00, }, ], From 68f10572d11b31bbe1d8e2bde413da979848787b Mon Sep 17 00:00:00 2001 From: ForGetFulSkyBro Date: Sat, 22 Nov 2025 16:12:33 -0500 Subject: [PATCH 29/30] add: Placeholders button to welcome settings --- .../selectionMenus/selectMenuWelcome.ts | 14 ++++- .../selectionMenus/selectMenuWelcomeType.ts | 14 ++++- src/buttons/welcomeMessages/welcome.ts | 14 ++++- .../welcomeEmbed/welcomeEmbed.ts | 14 ++++- src/buttons/welcomeMessages/welcomeMessage.ts | 14 ++++- src/buttons/welcomeMessages/welcomePing.ts | 14 ++++- .../welcomeMessages/welcomePlaceholders.ts | 63 +++++++++++++++++++ .../settings/settings-subcommands/welcomes.ts | 14 ++++- src/languages/de_DE.json | 1 + src/languages/en_EN.json | 1 + src/languages/es_ES.json | 1 + src/languages/fr_FR.json | 1 + src/languages/it_IT.json | 1 + 13 files changed, 152 insertions(+), 14 deletions(-) create mode 100644 src/buttons/welcomeMessages/welcomePlaceholders.ts diff --git a/src/buttons/selectionMenus/selectMenuWelcome.ts b/src/buttons/selectionMenus/selectMenuWelcome.ts index 094a3310..8b614389 100644 --- a/src/buttons/selectionMenus/selectMenuWelcome.ts +++ b/src/buttons/selectionMenus/selectMenuWelcome.ts @@ -108,7 +108,7 @@ const button: Button = { ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -124,7 +124,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -143,6 +143,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/selectionMenus/selectMenuWelcomeType.ts b/src/buttons/selectionMenus/selectMenuWelcomeType.ts index 7e8ca61c..26034013 100644 --- a/src/buttons/selectionMenus/selectMenuWelcomeType.ts +++ b/src/buttons/selectionMenus/selectMenuWelcomeType.ts @@ -112,7 +112,7 @@ const button: Button = { ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -128,7 +128,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -147,6 +147,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/welcomeMessages/welcome.ts b/src/buttons/welcomeMessages/welcome.ts index 3854763f..fa1dd3a5 100644 --- a/src/buttons/welcomeMessages/welcome.ts +++ b/src/buttons/welcomeMessages/welcome.ts @@ -110,7 +110,7 @@ const button: Button = { .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -126,7 +126,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -145,6 +145,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts index 268592bb..541af7d5 100644 --- a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts +++ b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts @@ -110,7 +110,7 @@ const button: Button = { ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -126,7 +126,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -145,6 +145,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/welcomeMessages/welcomeMessage.ts b/src/buttons/welcomeMessages/welcomeMessage.ts index c624d1d5..8e4bef82 100644 --- a/src/buttons/welcomeMessages/welcomeMessage.ts +++ b/src/buttons/welcomeMessages/welcomeMessage.ts @@ -138,7 +138,7 @@ const button: Button = { ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -154,7 +154,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -173,6 +173,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/welcomeMessages/welcomePing.ts b/src/buttons/welcomeMessages/welcomePing.ts index aa16b95f..b63ffa26 100644 --- a/src/buttons/welcomeMessages/welcomePing.ts +++ b/src/buttons/welcomeMessages/welcomePing.ts @@ -112,7 +112,7 @@ const button: Button = { ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -126,7 +126,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -145,6 +145,16 @@ const button: Button = { "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/buttons/welcomeMessages/welcomePlaceholders.ts b/src/buttons/welcomeMessages/welcomePlaceholders.ts new file mode 100644 index 00000000..0ab22553 --- /dev/null +++ b/src/buttons/welcomeMessages/welcomePlaceholders.ts @@ -0,0 +1,63 @@ +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + EmbedBuilder, + type MessageActionRowComponentBuilder, + type GuildMember, +} from "discord.js"; +import type { Button } from "../../interfaces"; + +const button: Button = { + name: "welcomePlaceholders", + cooldown: false, + execute: async (interaction, client, guildDb) => { + const member = interaction.member as GuildMember; + + const placeholderMap: Record = { + "{{user_displayname}}": member.user.displayName, + "{{user_tag}}": member.user.username, + "{{user_avatarUrl}}": member.user.avatarURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{@mention}}": `<@${member.user.id}>`, + "{{guild_name}}": member.guild.name, + "{{guild_member_count}}": member.guild.memberCount.toString(), + "{{guild_iconUrl}}": member.guild.iconURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{question}}": client.translation.get(guildDb.language, "Placeholders.embed.question"), + "{{new_line}}": "\\n", + }; + + const placeholderEmbed = new EmbedBuilder() + .setColor("#0598F6") + .setTitle(client.translation.get(guildDb.language, "Placeholders.embed.title")) + .addFields( + ...Object.entries(placeholderMap).map(([placeholder, value]) => ({ + name: placeholder, + value: value, + inline: false, + })), + ); + + const inter = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("welcomeEmbed") + .setEmoji("1308672399188820023") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeEmbed" + ) + ) + .setStyle(ButtonStyle.Primary) + ); + + interaction.update({ + embeds: [placeholderEmbed], + components: [inter], + options: { + ephemeral: true, + }, + }); + }, +}; + +export default button; diff --git a/src/commands/settings/settings-subcommands/welcomes.ts b/src/commands/settings/settings-subcommands/welcomes.ts index 2a1839af..c65d1bb5 100644 --- a/src/commands/settings/settings-subcommands/welcomes.ts +++ b/src/commands/settings/settings-subcommands/welcomes.ts @@ -110,7 +110,7 @@ export default async function settingsGeneral( ), new ButtonBuilder() .setCustomId("welcomePing") - .setEmoji("1207801424503644260") + .setEmoji("1185973660465500180") .setLabel( client.translation.get( guildDb?.language, @@ -126,7 +126,7 @@ export default async function settingsGeneral( new ActionRowBuilder().addComponents( new ButtonBuilder() .setCustomId("welcomeMessage") - .setEmoji("1185973660465500180") + .setEmoji("1207801424503644260") .setLabel( client.translation.get( guildDb?.language, @@ -145,6 +145,16 @@ export default async function settingsGeneral( "Settings.button.welcomeEmbedEdit" ) ) + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders" + ) + ) .setStyle(ButtonStyle.Primary) ); diff --git a/src/languages/de_DE.json b/src/languages/de_DE.json index adf9deaa..b519f25f 100644 --- a/src/languages/de_DE.json +++ b/src/languages/de_DE.json @@ -329,6 +329,7 @@ "welcomeEmbedTimestamp": "Zeitstempel umschalten", "welcomeEmbedToggle": "Einbetten umschalten", "welcomeEmbed": "Zurückgehen", + "welcomePlaceholders": "Platzhalter", "welcomeTest": "Test senden", "welcomeEmbedContentMenu": "Inhalt lƶschen", "welcomeEmbedTitleMenu": "Titel lƶschen", diff --git a/src/languages/en_EN.json b/src/languages/en_EN.json index 05fe04ae..29d03e8e 100644 --- a/src/languages/en_EN.json +++ b/src/languages/en_EN.json @@ -333,6 +333,7 @@ "welcomeEmbedTimestamp": "Toggle Timestamp", "welcomeEmbedToggle": "Toggle Embed", "welcomeEmbed": "Go Back", + "welcomePlaceholders": "Placeholders", "daySelect": "Exclude Days", "dailyInterval": "Set Post Time", "dailyChannel": "Set Channel", diff --git a/src/languages/es_ES.json b/src/languages/es_ES.json index 3ed52245..0434202b 100644 --- a/src/languages/es_ES.json +++ b/src/languages/es_ES.json @@ -341,6 +341,7 @@ "welcomeEmbedTimestamp": "Toggle Marca de tiempo", "welcomeEmbedToggle": "Toggle Insertar", "welcomeEmbed": "Volver atrĆ”s", + "welcomePlaceholders": "Marcadores de posición", "welcomeEmbedContentMenu": "Borrar contenido", "welcomeEmbedTitleMenu": "Borrar tĆ­tulo", "welcomeEmbedDescriptionMenu": "Borrar Descripción", diff --git a/src/languages/fr_FR.json b/src/languages/fr_FR.json index 747c85d0..1477e240 100644 --- a/src/languages/fr_FR.json +++ b/src/languages/fr_FR.json @@ -352,6 +352,7 @@ "welcomeEmbedImageMenu": "Supprimer l'image", "welcomeEmbedTimestampMenu": "Supprimer l'horodatage", "welcomeEmbed": "Retour", + "welcomePlaceholders": "Espaces rĆ©servĆ©s", "avatar": "DĆ©finir l'avatar", "name": "DĆ©finir le nom d'utilisateur", "customPerm": "DĆ©finir un rĆ“le d'autorisation personnalisĆ©", diff --git a/src/languages/it_IT.json b/src/languages/it_IT.json index b25b0fbe..a0f13700 100644 --- a/src/languages/it_IT.json +++ b/src/languages/it_IT.json @@ -341,6 +341,7 @@ "welcomeEmbedTimestamp": "Alterna il timestamp", "welcomeEmbedToggle": "Incorporare", "welcomeEmbed": "Torna indietro", + "welcomePlaceholders": "Sedimenti", "welcomeEmbedContentMenu": "Eliminare il contenuto", "welcomeEmbedTitleMenu": "Cancellare il titolo", "welcomeEmbedDescriptionMenu": "Cancellare la descrizione", From 32c8127c2f389f9f1b8025b993f74953badb91de Mon Sep 17 00:00:00 2001 From: mezotv Date: Sun, 23 Nov 2025 02:59:13 +0000 Subject: [PATCH 30/30] chore(style): format files --- src/buttons/dailyTasks/autoPin.ts | 75 ++--- src/buttons/dailyTasks/dailyDeleteRole.ts | 71 ++--- src/buttons/dailyTasks/dailyInterval.ts | 81 ++--- src/buttons/dailyTasks/dailyMsg.ts | 73 ++--- src/buttons/dailyTasks/dailyQuestionType.ts | 6 +- src/buttons/dailyTasks/dailyThread.ts | 73 ++--- src/buttons/dailyTasks/dailyTimezone.ts | 81 ++--- src/buttons/gamesActivities/higherlower.ts | 6 +- src/buttons/miscellaneous/deleteCustomPerm.ts | 37 +-- src/buttons/premium/webhookAvatar.ts | 31 +- src/buttons/premium/webhookName.ts | 37 +-- .../selectionMenus/selectMenuChannel.ts | 73 ++--- .../selectionMenus/selectMenuCustomRole.ts | 37 +-- src/buttons/selectionMenus/selectMenuDays.ts | 73 ++--- .../selectionMenus/selectMenuQuestionType.ts | 75 ++--- src/buttons/selectionMenus/selectMenuRole.ts | 71 ++--- src/buttons/selectionMenus/selectMenuType.ts | 75 ++--- .../selectionMenus/selectMenuWelcome.ts | 72 +++-- .../selectionMenus/selectMenuWelcomeEmbed.ts | 2 +- .../selectionMenus/selectMenuWelcomeType.ts | 76 +++-- src/buttons/utilityInformation/classicMode.ts | 29 +- src/buttons/utilityInformation/customPerm.ts | 4 +- src/buttons/utilityInformation/voting.ts | 29 +- src/buttons/welcomeMessages/welcome.ts | 72 +++-- .../welcomeEmbed/welcomeEmbed.ts | 74 +++-- .../welcomeEmbed/welcomeEmbedTitle.ts | 2 +- .../welcomeMessages/welcomeEmbedEdit.ts | 116 +++---- src/buttons/welcomeMessages/welcomeMessage.ts | 74 +++-- src/buttons/welcomeMessages/welcomePing.ts | 72 +++-- .../welcomeMessages/welcomePlaceholders.ts | 54 ++-- src/commands/index.ts | 18 +- src/commands/settings/custom.ts | 248 +++++++-------- .../settings/settings-subcommands/qotd.ts | 75 +++-- .../settings/settings-subcommands/utility.ts | 34 +-- .../settings/settings-subcommands/welcomes.ts | 283 ++++++++++-------- src/commands/utility/info.ts | 10 +- src/commands/utility/placeholders.ts | 39 ++- src/commands/utility/sync.ts | 2 +- src/commands/utility/vote.ts | 12 +- src/config.ts | 4 +- src/events/guildCreate.ts | 12 +- src/events/guildDelete.ts | 12 +- src/events/guildMemberAdd.ts | 21 +- src/util/Functions/fileToCollection.ts | 22 +- src/util/Functions/jsonImport.ts | 26 +- src/util/Models/guildModel.ts | 6 +- src/util/Models/zod/welcomeEmbed.ts | 22 +- src/util/dailyMessage.ts | 8 +- src/util/keepAlive.ts | 4 +- 49 files changed, 1351 insertions(+), 1158 deletions(-) diff --git a/src/buttons/dailyTasks/autoPin.ts b/src/buttons/dailyTasks/autoPin.ts index bd6e5b62..2e7ce318 100644 --- a/src/buttons/dailyTasks/autoPin.ts +++ b/src/buttons/dailyTasks/autoPin.ts @@ -24,32 +24,32 @@ const button: Button = { const check = guildDb.autoPin; const autoPin = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${check ? ":x:" : ":white_check_mark:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -61,11 +61,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -73,11 +73,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -85,8 +85,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -95,10 +95,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -108,11 +108,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -120,11 +120,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -132,10 +132,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -145,20 +145,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Secondary : ButtonStyle.Success + guildDb.autoPin ? ButtonStyle.Secondary : ButtonStyle.Success, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -166,12 +169,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/dailyTasks/dailyDeleteRole.ts b/src/buttons/dailyTasks/dailyDeleteRole.ts index 8ad5e9d0..4afee429 100644 --- a/src/buttons/dailyTasks/dailyDeleteRole.ts +++ b/src/buttons/dailyTasks/dailyDeleteRole.ts @@ -13,12 +13,12 @@ const button: Button = { execute: async (interaction, client, guildDb) => { const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyRole")}: :x:\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + @@ -26,16 +26,16 @@ const button: Button = { `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -47,11 +47,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -59,8 +59,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle(ButtonStyle.Secondary), new ButtonBuilder() @@ -69,8 +69,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -79,10 +79,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -92,11 +92,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -104,11 +104,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -116,10 +116,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -129,20 +129,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -150,12 +153,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/dailyTasks/dailyInterval.ts b/src/buttons/dailyTasks/dailyInterval.ts index 9117641f..f259ae64 100644 --- a/src/buttons/dailyTasks/dailyInterval.ts +++ b/src/buttons/dailyTasks/dailyInterval.ts @@ -10,7 +10,7 @@ import { Modal, type ModalData } from "../../util/modalHandler"; function isFormat(str: string) { return /^(?:[01]\d|2[0-4]):(?:00|05|10|15|20|25|30|35|40|45|50|55)$/.test( - str + str, ); } @@ -39,7 +39,7 @@ const button: Button = { ephemeral: true, content: client.translation.get( guildDb?.language, - "Settings.intervalSame" + "Settings.intervalSame", ), }); return; @@ -49,39 +49,39 @@ const button: Button = { ephemeral: true, content: client.translation.get( guildDb?.language, - "Settings.intervalInvalid" + "Settings.intervalInvalid", ), }); return; } const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${value}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -93,11 +93,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -105,11 +105,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -117,8 +117,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -127,10 +127,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -140,11 +140,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -152,11 +152,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -164,10 +164,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -177,20 +177,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -198,12 +201,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/dailyTasks/dailyMsg.ts b/src/buttons/dailyTasks/dailyMsg.ts index 3ae5e33a..648523d4 100644 --- a/src/buttons/dailyTasks/dailyMsg.ts +++ b/src/buttons/dailyTasks/dailyMsg.ts @@ -14,32 +14,32 @@ const button: Button = { const check = guildDb.dailyMsg; const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${check ? ":x:" : ":white_check_mark:"}` + "Settings.embed.dailyMsg", + )}: ${check ? ":x:" : ":white_check_mark:"}`, ) .setColor("#0598F6"); @@ -51,11 +51,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -63,11 +63,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -75,8 +75,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -85,10 +85,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -98,11 +98,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -110,11 +110,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -122,10 +122,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -135,20 +135,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -156,10 +159,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) - .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success) + .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/dailyTasks/dailyQuestionType.ts b/src/buttons/dailyTasks/dailyQuestionType.ts index 329aba54..1adfc8b9 100644 --- a/src/buttons/dailyTasks/dailyQuestionType.ts +++ b/src/buttons/dailyTasks/dailyQuestionType.ts @@ -41,15 +41,15 @@ const button: Button = { new StringSelectMenuOptionBuilder() .setLabel(`Topics`) .setDefault(guildDb.dailyQuestionType.includes("topicModel")) - .setValue("topicModel") - ) + .setValue("topicModel"), + ), ); interaction.update({ embeds: [], content: client.translation.get( guildDb?.language, - "Settings.dailyQuestionType" + "Settings.dailyQuestionType", ), components: [inter], options: { diff --git a/src/buttons/dailyTasks/dailyThread.ts b/src/buttons/dailyTasks/dailyThread.ts index ae78c878..893d2d0a 100644 --- a/src/buttons/dailyTasks/dailyThread.ts +++ b/src/buttons/dailyTasks/dailyThread.ts @@ -14,32 +14,32 @@ const button: Button = { const check = guildDb.dailyThread; const dailyThreads = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${check ? ":x:" : ":white_check_mark:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -51,11 +51,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -63,11 +63,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -75,8 +75,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -85,10 +85,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -98,11 +98,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -110,11 +110,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -122,10 +122,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -135,18 +135,21 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -154,12 +157,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/dailyTasks/dailyTimezone.ts b/src/buttons/dailyTasks/dailyTimezone.ts index b44c3335..8c5c5446 100644 --- a/src/buttons/dailyTasks/dailyTimezone.ts +++ b/src/buttons/dailyTasks/dailyTimezone.ts @@ -54,7 +54,7 @@ const button: Button = { ephemeral: true, content: client.translation.get( guildDb?.language, - "Settings.errorSame" + "Settings.errorSame", ), }); return; @@ -65,7 +65,7 @@ const button: Button = { ephemeral: true, content: client.translation.get( guildDb?.language, - "Settings.errorInvalid" + "Settings.errorInvalid", ), }); return; @@ -76,7 +76,7 @@ const button: Button = { ephemeral: true, content: client.translation.get( guildDb?.language, - "Settings.errorInvalid" + "Settings.errorInvalid", ), }); return; @@ -84,32 +84,32 @@ const button: Button = { const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${value}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -121,11 +121,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -133,11 +133,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -145,8 +145,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -155,10 +155,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -168,11 +168,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -180,11 +180,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -192,10 +192,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -205,20 +205,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -226,12 +229,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/gamesActivities/higherlower.ts b/src/buttons/gamesActivities/higherlower.ts index 5336b4ef..13a33504 100644 --- a/src/buttons/gamesActivities/higherlower.ts +++ b/src/buttons/gamesActivities/higherlower.ts @@ -125,8 +125,8 @@ const button: Button = { source2: game.items.history[game.items.history.length - 1].link || "https://wouldyoubot.gg/nolink", - } - )}` + }, + )}`, ) .setColor("White") .setImage("attachment://game.png") @@ -146,7 +146,7 @@ const button: Button = { new ButtonBuilder() .setCustomId(`lower_${game.id}`) .setLabel("Lower") - .setStyle(ButtonStyle.Danger) + .setStyle(ButtonStyle.Danger), ); interaction diff --git a/src/buttons/miscellaneous/deleteCustomPerm.ts b/src/buttons/miscellaneous/deleteCustomPerm.ts index 1c7f7933..b2b6578f 100644 --- a/src/buttons/miscellaneous/deleteCustomPerm.ts +++ b/src/buttons/miscellaneous/deleteCustomPerm.ts @@ -13,28 +13,31 @@ const button: Button = { execute: async (interaction, client, guildDb) => { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.utilityTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: :x:\n${client.translation.get( guildDb?.language, - "Settings.embed.username" + "Settings.embed.username", )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` + "Settings.embed.classicMode", + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -45,18 +48,18 @@ const button: Button = { .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name") + client.translation.get(guildDb?.language, "Settings.button.name"), ) .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar") + client.translation.get(guildDb?.language, "Settings.button.avatar"), ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const button2 = @@ -67,11 +70,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle( - guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success, ), new ButtonBuilder() .setCustomId("customPerm") @@ -79,10 +82,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) - .setStyle(ButtonStyle.Secondary) + .setStyle(ButtonStyle.Secondary), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/premium/webhookAvatar.ts b/src/buttons/premium/webhookAvatar.ts index da21c407..c8b9da08 100644 --- a/src/buttons/premium/webhookAvatar.ts +++ b/src/buttons/premium/webhookAvatar.ts @@ -56,28 +56,31 @@ const button: Button = { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.utilityTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.username" + "Settings.embed.username", )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: [Image](<${value}>)\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}` + "Settings.embed.classicMode", + )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -110,11 +113,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle( - guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("customPerm") @@ -122,12 +125,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) .setStyle( - guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); async function getImageData() { diff --git a/src/buttons/premium/webhookName.ts b/src/buttons/premium/webhookName.ts index 56007663..05d4a173 100644 --- a/src/buttons/premium/webhookName.ts +++ b/src/buttons/premium/webhookName.ts @@ -58,25 +58,28 @@ const button: Button = { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.utilityTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get(guildDb?.language, "Settings.embed.username")}: ${value}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}` + "Settings.embed.classicMode", + )}: ${guildDb.classicMode ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -87,18 +90,18 @@ const button: Button = { .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name") + client.translation.get(guildDb?.language, "Settings.button.name"), ) .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar") + client.translation.get(guildDb?.language, "Settings.button.avatar"), ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const button2 = @@ -109,11 +112,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle( - guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.classicMode ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("customPerm") @@ -121,12 +124,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) .setStyle( - guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/selectionMenus/selectMenuChannel.ts b/src/buttons/selectionMenus/selectMenuChannel.ts index e8147ffd..366facde 100644 --- a/src/buttons/selectionMenus/selectMenuChannel.ts +++ b/src/buttons/selectionMenus/selectMenuChannel.ts @@ -14,29 +14,29 @@ const button: Button = { const newChannel = (interaction as any).values[0]; const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get(guildDb?.language, "Settings.embed.dailyChannel")}: <#${newChannel}>\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -48,11 +48,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -60,11 +60,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -72,8 +72,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -82,10 +82,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -95,11 +95,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -107,11 +107,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -119,10 +119,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -132,20 +132,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -153,12 +156,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/selectionMenus/selectMenuCustomRole.ts b/src/buttons/selectionMenus/selectMenuCustomRole.ts index b1cdf15e..8a0a846e 100644 --- a/src/buttons/selectionMenus/selectMenuCustomRole.ts +++ b/src/buttons/selectionMenus/selectMenuCustomRole.ts @@ -14,28 +14,31 @@ const button: Button = { const newRole = interaction.values[0]; const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.utilityTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: <@&${newRole}>\n${client.translation.get( guildDb?.language, - "Settings.embed.username" + "Settings.embed.username", )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` + "Settings.embed.classicMode", + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -46,18 +49,18 @@ const button: Button = { .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name") + client.translation.get(guildDb?.language, "Settings.button.name"), ) .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar") + client.translation.get(guildDb?.language, "Settings.button.avatar"), ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const button2 = @@ -68,11 +71,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle( - guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success, ), new ButtonBuilder() .setCustomId("customPerm") @@ -80,10 +83,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/selectionMenus/selectMenuDays.ts b/src/buttons/selectionMenus/selectMenuDays.ts index 7f7e9c20..c4564ad3 100644 --- a/src/buttons/selectionMenus/selectMenuDays.ts +++ b/src/buttons/selectionMenus/selectMenuDays.ts @@ -15,32 +15,32 @@ const button: Button = { const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -52,11 +52,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -64,8 +64,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -74,8 +74,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -84,10 +84,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -97,11 +97,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -109,11 +109,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -121,10 +121,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -134,20 +134,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -155,12 +158,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild.id, { ...guildDb, diff --git a/src/buttons/selectionMenus/selectMenuQuestionType.ts b/src/buttons/selectionMenus/selectMenuQuestionType.ts index 424c80b2..c447783d 100644 --- a/src/buttons/selectionMenus/selectMenuQuestionType.ts +++ b/src/buttons/selectionMenus/selectMenuQuestionType.ts @@ -14,32 +14,32 @@ const button: Button = { const newType = interaction.values; const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -51,11 +51,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -63,11 +63,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -75,8 +75,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -85,10 +85,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -98,11 +98,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -110,11 +110,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -122,10 +122,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -135,20 +135,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -156,12 +159,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild.id, { diff --git a/src/buttons/selectionMenus/selectMenuRole.ts b/src/buttons/selectionMenus/selectMenuRole.ts index 3ff3d951..3e08c2c0 100644 --- a/src/buttons/selectionMenus/selectMenuRole.ts +++ b/src/buttons/selectionMenus/selectMenuRole.ts @@ -14,12 +14,12 @@ const button: Button = { const newRole = interaction.values[0]; const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyRole")}: <@&${newRole}>\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + @@ -27,16 +27,16 @@ const button: Button = { `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -48,11 +48,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -60,8 +60,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -70,8 +70,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -80,10 +80,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -93,11 +93,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -105,11 +105,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -117,10 +117,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -130,20 +130,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -151,12 +154,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild.id, { diff --git a/src/buttons/selectionMenus/selectMenuType.ts b/src/buttons/selectionMenus/selectMenuType.ts index 0b3028b9..af9be70c 100644 --- a/src/buttons/selectionMenus/selectMenuType.ts +++ b/src/buttons/selectionMenus/selectMenuType.ts @@ -14,32 +14,32 @@ const button: Button = { const newType = interaction.values[0]; const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${newType}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -51,11 +51,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") @@ -63,11 +63,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyRole" - ) + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") @@ -75,8 +75,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -85,10 +85,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); const dailyButtons2 = new ActionRowBuilder().addComponents( @@ -98,11 +98,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -110,11 +110,11 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") @@ -122,10 +122,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.daySelect" - ) + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); const dailyButtons3 = new ActionRowBuilder().addComponents( @@ -135,20 +135,23 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get( + guildDb?.language, + "Settings.button.autoPin", + ), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") @@ -156,12 +159,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyMsg" - ) + "Settings.button.dailyMsg", + ), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild.id, { diff --git a/src/buttons/selectionMenus/selectMenuWelcome.ts b/src/buttons/selectionMenus/selectMenuWelcome.ts index 8b614389..7b7b25bd 100644 --- a/src/buttons/selectionMenus/selectMenuWelcome.ts +++ b/src/buttons/selectionMenus/selectMenuWelcome.ts @@ -23,35 +23,38 @@ const button: Button = { const welcomes = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${guildDb.welcomeType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: <#${newChannel}>\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" + "Settings.embed.welcomeMessage", )}: ${ guildDb.welcomeMessage ? truncateString(guildDb.welcomeMessage, 100) : ":x:" - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -64,8 +67,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1185973667973320775"), @@ -75,25 +78,27 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled(guildDb.welcome ? false : true) .setStyle( - guildDb.welcome ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Primary : ButtonStyle.Secondary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); const welcomeButtons2 = new ActionRowBuilder().addComponents( @@ -101,10 +106,13 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomePing") @@ -112,12 +120,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const welcomeButtons3 = @@ -128,11 +136,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -140,8 +150,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -150,10 +160,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await client.database.updateGuild(interaction.guild.id, { diff --git a/src/buttons/selectionMenus/selectMenuWelcomeEmbed.ts b/src/buttons/selectionMenus/selectMenuWelcomeEmbed.ts index f4aab292..ef33ab13 100644 --- a/src/buttons/selectionMenus/selectMenuWelcomeEmbed.ts +++ b/src/buttons/selectionMenus/selectMenuWelcomeEmbed.ts @@ -70,7 +70,7 @@ const button: Button = { guildDb: guildDb, [interaction.values[0]]: ButtonStyle.Secondary, }); - const welcomeButtons5 = SelectMenu(client, guildDb); + const welcomeButtons5 = SelectMenu(client, guildDb); await client.database.updateGuild(interaction.guild?.id || "", { ...guildDb, diff --git a/src/buttons/selectionMenus/selectMenuWelcomeType.ts b/src/buttons/selectionMenus/selectMenuWelcomeType.ts index 26034013..b4a363da 100644 --- a/src/buttons/selectionMenus/selectMenuWelcomeType.ts +++ b/src/buttons/selectionMenus/selectMenuWelcomeType.ts @@ -23,35 +23,38 @@ const button: Button = { const dailyMsgs = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${newType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" + "Settings.embed.welcomeMessage", )}: ${ guildDb.welcomeMessage ? truncateString(guildDb.welcomeMessage, 100) : ":x:" - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -64,8 +67,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1185973667973320775"), @@ -75,29 +78,31 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled( - guildDb.welcomeChannel && guildDb?.welcome ? false : true + guildDb.welcomeChannel && guildDb?.welcome ? false : true, ) .setStyle( guildDb.welcomeChannel && guildDb?.welcome ? ButtonStyle.Primary - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); const welcomeButtons2 = new ActionRowBuilder().addComponents( @@ -105,10 +110,13 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomePing") @@ -116,14 +124,14 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); - + const welcomeButtons3 = new ActionRowBuilder().addComponents( new ButtonBuilder() @@ -132,11 +140,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -144,8 +154,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -154,10 +164,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await client.database.updateGuild(interaction.guild.id, { diff --git a/src/buttons/utilityInformation/classicMode.ts b/src/buttons/utilityInformation/classicMode.ts index f41161f7..70d0a27c 100644 --- a/src/buttons/utilityInformation/classicMode.ts +++ b/src/buttons/utilityInformation/classicMode.ts @@ -14,28 +14,31 @@ const button: Button = { const check = guildDb.classicMode; const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.utilityTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.username" + "Settings.embed.username", )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${check ? ":x:" : ":white_check_mark:"}` + "Settings.embed.classicMode", + )}: ${check ? ":x:" : ":white_check_mark:"}`, ) .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.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), new ButtonBuilder() @@ -78,12 +81,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) .setStyle( - guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/utilityInformation/customPerm.ts b/src/buttons/utilityInformation/customPerm.ts index 67a60987..58bd6926 100644 --- a/src/buttons/utilityInformation/customPerm.ts +++ b/src/buttons/utilityInformation/customPerm.ts @@ -15,7 +15,7 @@ const button: Button = { new ActionRowBuilder().addComponents( new RoleSelectMenuBuilder() .setCustomId("selectMenuCustomRole") - .setPlaceholder("Select a role that can add custom messages.") + .setPlaceholder("Select a role that can add custom messages."), ); const inter2 = @@ -23,7 +23,7 @@ const button: Button = { new ButtonBuilder() .setCustomId("deleteCustomPerm") .setLabel("Delete Custom Permission Role") - .setStyle(ButtonStyle.Danger) + .setStyle(ButtonStyle.Danger), ); interaction.update({ diff --git a/src/buttons/utilityInformation/voting.ts b/src/buttons/utilityInformation/voting.ts index 13b7b209..eb2593a4 100644 --- a/src/buttons/utilityInformation/voting.ts +++ b/src/buttons/utilityInformation/voting.ts @@ -1,4 +1,9 @@ -import { ActionRowBuilder, AnyComponentBuilder, ButtonBuilder, ButtonComponentData } from "discord.js"; +import { + ActionRowBuilder, + AnyComponentBuilder, + ButtonBuilder, + ButtonComponentData, +} from "discord.js"; import type { Button } from "../../interfaces"; const button: Button = { @@ -33,21 +38,25 @@ const button: Button = { } else { replyContent; } - const unchangedRow = ActionRowBuilder.from(interaction.message.components[1]) - const updatedResult = ActionRowBuilder.from(interaction.message.components[0]) - + const unchangedRow = ActionRowBuilder.from( + interaction.message.components[1], + ); + const updatedResult = ActionRowBuilder.from( + interaction.message.components[0], + ); + const resultButton = updatedResult.components[0] as ButtonBuilder; resultButton.setDisabled(false); // @ts-expect-error no clue why it complains but it works! await interaction.update({ - components: [updatedResult, unchangedRow] - }) + components: [updatedResult, unchangedRow], + }); - interaction.followUp({ - content: replyContent, - ephemeral: true, - }); + interaction.followUp({ + content: replyContent, + ephemeral: true, + }); }, }; diff --git a/src/buttons/welcomeMessages/welcome.ts b/src/buttons/welcomeMessages/welcome.ts index fa1dd3a5..2e699fab 100644 --- a/src/buttons/welcomeMessages/welcome.ts +++ b/src/buttons/welcomeMessages/welcome.ts @@ -23,35 +23,38 @@ const button: Button = { const welcomes = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${check ? ":x:" : ":white_check_mark:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${guildDb.welcomeType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" + "Settings.embed.welcomeMessage", )}: ${ guildDb.welcomeMessage ? truncateString(guildDb.welcomeMessage, 100) : ":x:" - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -64,8 +67,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1185973667973320775"), @@ -75,29 +78,31 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled( - guildDb.welcomeChannel && guildDb?.welcome ? true : false + guildDb.welcomeChannel && guildDb?.welcome ? true : false, ) .setStyle( guildDb.welcomeChannel && guildDb?.welcome ? ButtonStyle.Secondary - : ButtonStyle.Primary + : ButtonStyle.Primary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); const welcomeButtons2 = new ActionRowBuilder().addComponents( @@ -105,7 +110,10 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), new ButtonBuilder() @@ -114,12 +122,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const welcomeButtons3 = @@ -130,11 +138,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -142,8 +152,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -152,10 +162,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts index 541af7d5..1d815c1d 100644 --- a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts +++ b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbed.ts @@ -19,35 +19,38 @@ const button: Button = { const welcomeEmbed = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${guildDb.welcomeType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" + "Settings.embed.welcomeMessage", )}: ${ guildDb.welcomeMessage ? truncateString(guildDb.welcomeMessage, 100) : ":x:" - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -60,8 +63,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -70,29 +73,31 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled( - guildDb.welcomeChannel && guildDb?.welcome ? false : true + guildDb.welcomeChannel && guildDb?.welcome ? false : true, ) .setStyle( guildDb.welcomeChannel && guildDb?.welcome ? ButtonStyle.Primary - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); // Second button row @@ -103,10 +108,13 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomePing") @@ -114,12 +122,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const welcomeButtons3 = @@ -130,11 +138,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -142,8 +152,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -152,10 +162,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await interaction.update({ diff --git a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbedTitle.ts b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbedTitle.ts index 66613509..8360136c 100644 --- a/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbedTitle.ts +++ b/src/buttons/welcomeMessages/welcomeEmbed/welcomeEmbedTitle.ts @@ -102,4 +102,4 @@ const button: Button = { }, }; -export default button; \ No newline at end of file +export default button; diff --git a/src/buttons/welcomeMessages/welcomeEmbedEdit.ts b/src/buttons/welcomeMessages/welcomeEmbedEdit.ts index 071c15cb..8cdb9fe9 100644 --- a/src/buttons/welcomeMessages/welcomeEmbedEdit.ts +++ b/src/buttons/welcomeMessages/welcomeEmbedEdit.ts @@ -43,13 +43,13 @@ export function embed({ }) { return new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle"), ) .setFields([ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeContent" + "Settings.embed.welcomeContent", ), value: `\`\`\`${content.slice(0, 400)}\`\`\``, inline: false, @@ -57,7 +57,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeTitles" + "Settings.embed.welcomeTitles", ), value: `\`\`\`${title.slice(0, 100)}\`\`\``, inline: true, @@ -65,7 +65,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeTitlesURL" + "Settings.embed.welcomeTitlesURL", ), value: `\`\`\`${titleURL.slice(0, 30)}\`\`\``, inline: true, @@ -73,7 +73,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeDescription" + "Settings.embed.welcomeDescription", ), value: `\`\`\`${description.slice(0, 800)}\`\`\``, inline: false, @@ -81,7 +81,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeAuthorName" + "Settings.embed.welcomeAuthorName", ), value: `\`\`\`${author.slice(0, 100)}\`\`\``, inline: false, @@ -89,7 +89,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeAuthorURL" + "Settings.embed.welcomeAuthorURL", ), value: `\`\`\`${authorURL.slice(0, 30)}\`\`\``, inline: true, @@ -97,7 +97,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeThumbnailURL" + "Settings.embed.welcomeThumbnailURL", ), value: `\`\`\`${thumbnail.slice(0, 30)}\`\`\``, inline: true, @@ -105,7 +105,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeFooterText" + "Settings.embed.welcomeFooterText", ), value: `\`\`\`${footer.slice(0, 100)}\`\`\``, inline: false, @@ -113,7 +113,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeFooterURL" + "Settings.embed.welcomeFooterURL", ), value: `\`\`\`${footerURL.slice(0, 50)}\`\`\``, inline: true, @@ -121,7 +121,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeImageURL" + "Settings.embed.welcomeImageURL", ), value: `\`\`\`${image.slice(0, 50)}\`\`\``, inline: true, @@ -129,7 +129,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeColor" + "Settings.embed.welcomeColor", ), value: `\`\`\`${color}\`\`\``, inline: false, @@ -137,7 +137,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeTimestamp" + "Settings.embed.welcomeTimestamp", ), value: `\`\`\`${timestamp === true ? "āœ…" : "āŒ"}\`\`\``, inline: true, @@ -145,7 +145,7 @@ export function embed({ { name: client.translation.get( guildDb?.language, - "Settings.embed.welcomeToggle" + "Settings.embed.welcomeToggle", ), value: `\`\`\`${toggle === true ? "āœ…" : "āŒ"}\`\`\``, inline: true, @@ -188,8 +188,8 @@ export function Button1({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedTitle" - ) + "Settings.button.welcomeEmbedTitle", + ), ) .setStyle(title) .setEmoji("1185973664538177557"), @@ -199,8 +199,8 @@ export function Button1({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedDescription" - ) + "Settings.button.welcomeEmbedDescription", + ), ) .setStyle(description), new ButtonBuilder() @@ -209,8 +209,8 @@ export function Button1({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedAuthorName" - ) + "Settings.button.welcomeEmbedAuthorName", + ), ) .setStyle(author), new ButtonBuilder() @@ -218,11 +218,11 @@ export function Button1({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedAuthorURL" - ) + "Settings.button.welcomeEmbedAuthorURL", + ), ) .setStyle(authorURL) - .setEmoji("1185973664538177557") + .setEmoji("1185973664538177557"), ); } @@ -252,8 +252,8 @@ export function Button2({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedThumbnail" - ) + "Settings.button.welcomeEmbedThumbnail", + ), ) .setStyle(thumbnail), new ButtonBuilder() @@ -262,8 +262,8 @@ export function Button2({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedImage" - ) + "Settings.button.welcomeEmbedImage", + ), ) .setStyle(image), new ButtonBuilder() @@ -272,10 +272,10 @@ export function Button2({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedTimestamp" - ) + "Settings.button.welcomeEmbedTimestamp", + ), ) - .setStyle(timestamp) + .setStyle(timestamp), ); } @@ -305,8 +305,8 @@ export function Button3({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedFooterText" - ) + "Settings.button.welcomeEmbedFooterText", + ), ) .setStyle(footer), new ButtonBuilder() @@ -315,8 +315,8 @@ export function Button3({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedFooterURL" - ) + "Settings.button.welcomeEmbedFooterURL", + ), ) .setStyle(footerURL), new ButtonBuilder() @@ -325,10 +325,10 @@ export function Button3({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedColor" - ) + "Settings.button.welcomeEmbedColor", + ), ) - .setStyle(color) + .setStyle(color), ); } @@ -354,8 +354,8 @@ export function Button4({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedContent" - ) + "Settings.button.welcomeEmbedContent", + ), ) .setStyle(content), new ButtonBuilder() @@ -364,8 +364,8 @@ export function Button4({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedToggle" - ) + "Settings.button.welcomeEmbedToggle", + ), ) .setStyle(toggle), new ButtonBuilder() @@ -374,10 +374,10 @@ export function Button4({ .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbed" - ) + "Settings.button.welcomeEmbed", + ), ) - .setStyle(embed) + .setStyle(embed), ); } @@ -388,14 +388,14 @@ export function SelectMenu(client: any, guildDb: any) { .setPlaceholder( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedDeleteSettings" - ) + "Settings.button.welcomeEmbedDeleteSettings", + ), ) .addOptions([ { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedAuthorNameMenu" + "Settings.button.welcomeEmbedAuthorNameMenu", ), value: "author", description: "Delete the author name.", @@ -403,7 +403,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedAuthorURLMenu" + "Settings.button.welcomeEmbedAuthorURLMenu", ), value: "authorURL", description: "Delete the author URL.", @@ -411,7 +411,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedTitleMenu" + "Settings.button.welcomeEmbedTitleMenu", ), value: "title", description: "Delete the title.", @@ -420,7 +420,7 @@ export function SelectMenu(client: any, guildDb: any) { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedTitleMenu" + "Settings.button.welcomeEmbedTitleMenu", ) + " URL", value: "titleURL", description: "Delete the title URL.", @@ -428,7 +428,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedDescriptionMenu" + "Settings.button.welcomeEmbedDescriptionMenu", ), value: "description", description: "Delete the description.", @@ -436,7 +436,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedContentMenu" + "Settings.button.welcomeEmbedContentMenu", ), value: "content", description: "Delete the content.", @@ -444,7 +444,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedThumbnailMenu" + "Settings.button.welcomeEmbedThumbnailMenu", ), value: "thumbnail", description: "Delete the thumbnail.", @@ -452,7 +452,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedImageMenu" + "Settings.button.welcomeEmbedImageMenu", ), value: "image", description: "Delete the image.", @@ -460,7 +460,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedFooterTextMenu" + "Settings.button.welcomeEmbedFooterTextMenu", ), value: "footer", description: "Delete the footer text.", @@ -468,7 +468,7 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedFooterURLMenu" + "Settings.button.welcomeEmbedFooterURLMenu", ), value: "footerURL", description: "Delete the footer URL.", @@ -476,12 +476,12 @@ export function SelectMenu(client: any, guildDb: any) { { label: client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedColorMenu" + "Settings.button.welcomeEmbedColorMenu", ), value: "color", description: "Delete the color.", }, - ]) + ]), ); } diff --git a/src/buttons/welcomeMessages/welcomeMessage.ts b/src/buttons/welcomeMessages/welcomeMessage.ts index 8e4bef82..9d43a007 100644 --- a/src/buttons/welcomeMessages/welcomeMessage.ts +++ b/src/buttons/welcomeMessages/welcomeMessage.ts @@ -49,31 +49,34 @@ const button: Button = { const welcomeEmbed = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${guildDb.welcomeType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" - )}: ${truncateString(value, 100)}` + "Settings.embed.welcomeMessage", + )}: ${truncateString(value, 100)}`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -88,8 +91,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -98,29 +101,31 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled( - guildDb.welcomeChannel && guildDb?.welcome ? false : true + guildDb.welcomeChannel && guildDb?.welcome ? false : true, ) .setStyle( guildDb.welcomeChannel && guildDb?.welcome ? ButtonStyle.Primary - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); // Second button row @@ -131,10 +136,13 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomePing") @@ -142,12 +150,12 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const welcomeButtons3 = @@ -158,11 +166,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -170,8 +180,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -180,10 +190,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/welcomeMessages/welcomePing.ts b/src/buttons/welcomeMessages/welcomePing.ts index b63ffa26..5e425d3f 100644 --- a/src/buttons/welcomeMessages/welcomePing.ts +++ b/src/buttons/welcomeMessages/welcomePing.ts @@ -23,35 +23,38 @@ const button: Button = { const welcomes = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.welcome" + "Settings.embed.welcome", )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomePing" + "Settings.embed.welcomePing", )}: ${check ? ":x:" : ":white_check_mark:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.dailyType" + "Settings.embed.dailyType", )}: ${guildDb.welcomeType}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeChannel" + "Settings.embed.welcomeChannel", )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.welcomeMessage" + "Settings.embed.welcomeMessage", )}: ${ guildDb.welcomeMessage ? truncateString(guildDb.welcomeMessage, 100) : ":x:" - }` + }`, ) .setColor("#0598F6") .setFooter({ text: client.translation.get( guildDb?.language, - "Settings.embed.footer" + "Settings.embed.footer", ), iconURL: client?.user?.displayAvatarURL() || undefined, }); @@ -64,8 +67,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyType" - ) + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary) .setEmoji("1185973667973320775"), @@ -75,29 +78,31 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeChannel" - ) + "Settings.button.welcomeChannel", + ), ) .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeTest") .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeTest" - ) + "Settings.button.welcomeTest", + ), ) .setDisabled( - guildDb.welcomeChannel && guildDb?.welcome ? false : true + guildDb.welcomeChannel && guildDb?.welcome ? false : true, ) .setStyle( guildDb.welcomeChannel && guildDb?.welcome ? ButtonStyle.Primary - : ButtonStyle.Secondary + : ButtonStyle.Secondary, ) - .setEmoji("1207800685928910909") + .setEmoji("1207800685928910909"), ); const welcomeButtons2 = new ActionRowBuilder().addComponents( @@ -105,10 +110,13 @@ const button: Button = { .setCustomId("welcome") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomePing") @@ -116,10 +124,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePing" - ) + "Settings.button.welcomePing", + ), ) - .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success) + .setStyle(check ? ButtonStyle.Secondary : ButtonStyle.Success), ); const welcomeButtons3 = @@ -130,11 +138,13 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeMessage" - ) + "Settings.button.welcomeMessage", + ), ) .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("welcomeEmbedEdit") @@ -142,8 +152,8 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomeEmbedEdit" - ) + "Settings.button.welcomeEmbedEdit", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -152,10 +162,10 @@ const button: Button = { .setLabel( client.translation.get( guildDb?.language, - "Settings.button.welcomePlaceholders" - ) + "Settings.button.welcomePlaceholders", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); await client.database.updateGuild(interaction.guild?.id || "", { diff --git a/src/buttons/welcomeMessages/welcomePlaceholders.ts b/src/buttons/welcomeMessages/welcomePlaceholders.ts index 0ab22553..4b024cd3 100644 --- a/src/buttons/welcomeMessages/welcomePlaceholders.ts +++ b/src/buttons/welcomeMessages/welcomePlaceholders.ts @@ -17,38 +17,48 @@ const button: Button = { const placeholderMap: Record = { "{{user_displayname}}": member.user.displayName, "{{user_tag}}": member.user.username, - "{{user_avatarUrl}}": member.user.avatarURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{user_avatarUrl}}": + member.user.avatarURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", "{{@mention}}": `<@${member.user.id}>`, "{{guild_name}}": member.guild.name, "{{guild_member_count}}": member.guild.memberCount.toString(), - "{{guild_iconUrl}}": member.guild.iconURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", - "{{question}}": client.translation.get(guildDb.language, "Placeholders.embed.question"), + "{{guild_iconUrl}}": + member.guild.iconURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", + "{{question}}": client.translation.get( + guildDb.language, + "Placeholders.embed.question", + ), "{{new_line}}": "\\n", }; const placeholderEmbed = new EmbedBuilder() .setColor("#0598F6") - .setTitle(client.translation.get(guildDb.language, "Placeholders.embed.title")) - .addFields( + .setTitle( + client.translation.get(guildDb.language, "Placeholders.embed.title"), + ) + .addFields( ...Object.entries(placeholderMap).map(([placeholder, value]) => ({ - name: placeholder, - value: value, - inline: false, - })), + name: placeholder, + value: value, + inline: false, + })), + ); + + const inter = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("welcomeEmbed") + .setEmoji("1308672399188820023") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeEmbed", + ), + ) + .setStyle(ButtonStyle.Primary), ); - - const inter = new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("welcomeEmbed") - .setEmoji("1308672399188820023") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomeEmbed" - ) - ) - .setStyle(ButtonStyle.Primary) - ); interaction.update({ embeds: [placeholderEmbed], diff --git a/src/commands/index.ts b/src/commands/index.ts index 2316e736..a4f6138d 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -21,7 +21,7 @@ const commandInteractionEvent: Event = { if (interaction.isCommand()) { console.log( - `[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.username}) COMMAND ${interaction.commandName}` + `[INFO] INTERACTION ${interaction.id} RUN BY (${interaction.user.id}, ${interaction.user.username}) COMMAND ${interaction.commandName}`, ); const command = client.commands.get(interaction.commandName); @@ -30,7 +30,7 @@ const commandInteractionEvent: Event = { if (interaction.guildId !== null) { guildDb = await client.database.getGuild( interaction.guildId as string, - true + true, ); client.database .updateGuild(interaction.guildId as string, { @@ -55,24 +55,24 @@ const commandInteractionEvent: Event = { if (guildDb.commandType == "Command") { cooldownKey = `${interaction.guild?.id}-${interaction.commandName}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, ); } else if (guildDb.commandType == "User") { cooldownKey = `${interaction.guild?.id}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, ); } } else if (guildDb?.commandBy == "User") { if (guildDb.commandType == "Command") { cooldownKey = `${interaction.user?.id}-${interaction.commandName}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, ); } else if (guildDb.commandType == "User") { cooldownKey = `${interaction.guild?.id}`; cooldown = Number( - guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0 + guildDb?.commandCooldown != null ? guildDb.commandCooldown : 0, ); } } @@ -113,7 +113,7 @@ const commandInteractionEvent: Event = { // Increment the specified field using $inc await UserModel.updateOne( { userID: interaction.user?.id }, // Specify the query to find the user - { $inc: { [fieldPath]: 1 } } // Use computed fieldPath + { $inc: { [fieldPath]: 1 } }, // Use computed fieldPath ); } @@ -147,7 +147,7 @@ const commandInteractionEvent: Event = { .execute( interaction as ChatInputCommandInteraction, client, - guildDb as IGuildModel + guildDb as IGuildModel, ) .then(async () => { if (guildDb && guildDb?.dmsError) { @@ -163,7 +163,7 @@ const commandInteractionEvent: Event = { }, ], }) - .catch(() => {}); + .catch(() => {}); client.database.updateGuild(guildDb.guildID, { dmsError: null }); } diff --git a/src/commands/settings/custom.ts b/src/commands/settings/custom.ts index f16338ce..52e21071 100644 --- a/src/commands/settings/custom.ts +++ b/src/commands/settings/custom.ts @@ -41,7 +41,7 @@ const command: ChatInputCommand = { option .setName("options") .setDescription( - "Select which category you want this custom message to be in." + "Select which category you want this custom message to be in.", ) .setRequired(true) .addChoices( @@ -50,17 +50,17 @@ const command: ChatInputCommand = { { name: "What Would You Do", value: "wwyd" }, { name: "Truth", value: "truth" }, { name: "Dare", value: "dare" }, - { name: "Topic", value: "topic" } - ) + { name: "Topic", value: "topic" }, + ), ) .addStringOption((option) => option .setName("message") .setDescription( - "Input a message to create a custom WouldYou message." + "Input a message to create a custom WouldYou message.", ) - .setRequired(true) - ) + .setRequired(true), + ), ) .addSubcommand((subcommand) => subcommand @@ -70,18 +70,18 @@ const command: ChatInputCommand = { option .setName("message") .setDescription("Input a custom WouldYou ID number to remove it.") - .setRequired(true) - ) + .setRequired(true), + ), ) .addSubcommand((subcommand) => subcommand .setName("removeall") - .setDescription("Removes all custom messages.") + .setDescription("Removes all custom messages."), ) .addSubcommand((subcommand) => subcommand .setName("view") - .setDescription("Views all of your custom WouldYou messages") + .setDescription("Views all of your custom WouldYou messages"), ) .addSubcommand((subcommand) => subcommand @@ -91,15 +91,15 @@ const command: ChatInputCommand = { option .setName("attachment") .setDescription( - "Import a JSON file containing useless or useful Would You custom messages." + "Import a JSON file containing useless or useful Would You custom messages.", ) - .setRequired(true) - ) + .setRequired(true), + ), ) .addSubcommand((subcommand) => subcommand .setName("export") - .setDescription("Exports custom messages into a JSON file.") + .setDescription("Exports custom messages into a JSON file."), ), execute: async (interaction, client, guildDb) => { @@ -110,7 +110,7 @@ const command: ChatInputCommand = { if ( guildDb.customPerm ? (interaction?.member?.roles as Readonly).cache.has( - guildDb.customPerm + guildDb.customPerm, ) : ( interaction?.member?.permissions as Readonly @@ -133,7 +133,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Premium") .setStyle(ButtonStyle.Link) - .setURL("https://wouldyoubot.gg/premium") + .setURL("https://wouldyoubot.gg/premium"), ); interaction.reply({ content: `:x: ${client.translation.get( @@ -141,7 +141,7 @@ const command: ChatInputCommand = { "wyCustom.error.limit", { type: `\`${option}\``, - } + }, )}`, components: [premiumButton], ephemeral: true, @@ -157,22 +157,22 @@ const command: ChatInputCommand = { client, message || "", newID, - guildDb + guildDb, ); else if (option === "wwyd") generativeText = generateWWYD( client, message || "", newID, - guildDb + guildDb, ); else generativeText = { value: true, type: option }; typeEmbed = new EmbedBuilder() .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.title" - ) + "wyCustom.success.embedAdd.title", + ), ) .setColor("#0598F4") .setDescription( @@ -187,29 +187,29 @@ const command: ChatInputCommand = { generativeText?.type === "wouldyourather" ? client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descWYR" + "wyCustom.success.embedAdd.descWYR", ) : generativeText?.type === "wwyd" ? client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descWWYD" + "wyCustom.success.embedAdd.descWWYD", ) : client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descNHIE" + "wyCustom.success.embedAdd.descNHIE", ), - } + }, )}\n\n` }**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}**: ${newID}\n**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descCat" + "wyCustom.success.embedAdd.descCat", )}**: ${option}\n\n**${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descCont" - )}**: \`${message}\`` + "wyCustom.success.embedAdd.descCont", + )}**: \`${message}\``, ) .setFooter({ text: `Would You ${ @@ -232,7 +232,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: guildDb.customMessages, }, - true + true, ); const add = @@ -244,7 +244,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Don't Add") .setStyle(ButtonStyle.Secondary) - .setCustomId(`wycustom_remove-${newID}`) + .setCustomId(`wycustom_remove-${newID}`), ); const addDisable = @@ -258,7 +258,7 @@ const command: ChatInputCommand = { .setLabel("Don't Add") .setDisabled(true) .setStyle(ButtonStyle.Secondary) - .setCustomId("wycustom_remove") + .setCustomId("wycustom_remove"), ); interaction @@ -272,7 +272,7 @@ const command: ChatInputCommand = { embeds: [typeEmbed], components: [add], ephemeral: true, - } + }, ) .then((msg) => setTimeout(() => { @@ -280,7 +280,7 @@ const command: ChatInputCommand = { msg.edit({ components: [addDisable] }); client.customAdd.delete(newID); } - }, 30 * 1000) + }, 30 * 1000), ) .catch((err) => { console.log(err); @@ -294,8 +294,8 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedRemove.title" - ) + "wyCustom.success.embedRemove.title", + ), ) .setColor("#0598F4") .setFooter({ @@ -314,7 +314,7 @@ const command: ChatInputCommand = { ephemeral: true, }); const filtered = guildDb.customMessages.filter( - (c) => c.id !== message + (c) => c.id !== message, ); await client.database.updateGuild( @@ -323,7 +323,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: filtered, }, - true + true, ); break; } @@ -332,7 +332,7 @@ const command: ChatInputCommand = { interaction.reply({ content: client.translation.get( guildDb?.language, - "wyCustom.success.embedRemoveAll.none" + "wyCustom.success.embedRemoveAll.none", ), ephemeral: true, }); @@ -343,8 +343,8 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.embedRemoveAll.title" - ) + "wyCustom.success.embedRemoveAll.title", + ), ) .setColor("#0598F4") .setFooter({ @@ -361,7 +361,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Decline") .setStyle(ButtonStyle.Secondary) - .setCustomId("wycustom_decline") + .setCustomId("wycustom_decline"), ); interaction.reply({ @@ -377,7 +377,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.empty" + "wyCustom.error.empty", ), }); return; @@ -406,17 +406,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg" - )}: ${s.question}` + "wyCustom.success.embedAdd.descMsg", + )}: ${s.question}`, ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5) + (a, r) => data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -426,17 +426,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatNHIE" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatNHIE", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -451,17 +451,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg" - )}: ${s.question}` + "wyCustom.success.embedAdd.descMsg", + )}: ${s.question}`, ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5) + (a, r) => data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -471,17 +471,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatWYR" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatWYR", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -495,17 +495,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg" - )}: ${s.question}` + "wyCustom.success.embedAdd.descMsg", + )}: ${s.question}`, ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5) + (a, r) => data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -515,17 +515,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatTRUTH" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatTRUTH", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -539,17 +539,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg" - )}: ${s.question}` + "wyCustom.success.embedAdd.descMsg", + )}: ${s.question}`, ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5) + (a, r) => data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -559,17 +559,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatDARE" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatDARE", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -583,17 +583,17 @@ const command: ChatInputCommand = { (s, i) => `${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descID" + "wyCustom.success.embedAdd.descID", )}: ${s.id}\n${client.translation.get( guildDb?.language, - "wyCustom.success.embedAdd.descMsg" - )}: ${s.question}` + "wyCustom.success.embedAdd.descMsg", + )}: ${s.question}`, ); data = Array.from( { length: Math.ceil(data.length / 5), }, - (a, r) => data.slice(r * 5, r * 5 + 5) + (a, r) => data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -603,17 +603,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatWWYD" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatWWYD", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -625,7 +625,7 @@ const command: ChatInputCommand = { .filter((c) => c.type === "topic") .map((s, i) => `${s.id}: ${s.question}`); data = Array.from({ length: Math.ceil(data.length / 5) }, (a, r) => - data.slice(r * 5, r * 5 + 5) + data.slice(r * 5, r * 5 + 5), ); Math.ceil(data.length / 5); @@ -635,17 +635,17 @@ const command: ChatInputCommand = { .setTitle( client.translation.get( guildDb?.language, - "wyCustom.success.paginator.title" - ) + "wyCustom.success.paginator.title", + ), ) .setDescription( `${client.translation.get( guildDb?.language, - "wyCustom.success.paginator.descCatTOPIC" - )}\n\n${e.slice(0, 5).join("\n\n").toString()}` + "wyCustom.success.paginator.descCatTOPIC", + )}\n\n${e.slice(0, 5).join("\n\n").toString()}`, ) - .setColor("#0795F6") - ) + .setColor("#0795F6"), + ), ); } @@ -660,7 +660,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att1" + "wyCustom.error.import.att1", ), }); return; @@ -671,7 +671,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att2" + "wyCustom.error.import.att2", ), }); return; @@ -694,7 +694,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att3" + "wyCustom.error.import.att3", ), }); return; @@ -714,7 +714,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4" + "wyCustom.error.import.att4", ), }); return; @@ -734,7 +734,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4" + "wyCustom.error.import.att4", ), }); return; @@ -768,7 +768,7 @@ const command: ChatInputCommand = { new ButtonBuilder() .setLabel("Premium") .setStyle(ButtonStyle.Link) - .setURL("https://wouldyoubot.gg/premium") + .setURL("https://wouldyoubot.gg/premium"), ); interaction.editReply({ @@ -777,7 +777,7 @@ const command: ChatInputCommand = { "wyCustom.error.limit", { type: all.map((e) => `\`${e}\``).join(", "), - } + }, )}\n\n${client.translation.get(guildDb?.language, "wyCustom.error.addToLimit")}`, components: [premiumButton], }); @@ -792,7 +792,7 @@ const command: ChatInputCommand = { return interaction.editReply({ content: client.translation.get( guildDb?.language, - "wyCustom.error.import.att4" + "wyCustom.error.import.att4", ), components: [], }); @@ -802,7 +802,7 @@ const command: ChatInputCommand = { if (response.data.wouldyourather) { let i = guildDb.customMessages.filter( - (e) => e.type === "wouldyourather" + (e) => e.type === "wouldyourather", ).length; response.data.wouldyourather.map((d: any) => { if (prem.length > 0 && i === 100) return; @@ -818,7 +818,7 @@ const command: ChatInputCommand = { if (response.data.truth) { let i = guildDb.customMessages.filter( - (e) => e.type === "truth" + (e) => e.type === "truth", ).length; response.data.truth.map((d: any) => { if (prem.length > 0 && i === 100) return; @@ -834,7 +834,7 @@ const command: ChatInputCommand = { if (response.data.dare) { let i = guildDb.customMessages.filter( - (e) => e.type === "dare" + (e) => e.type === "dare", ).length; response.data.dare.map((d: any) => { if (prem.length > 0 && i === 100) return; @@ -850,7 +850,7 @@ const command: ChatInputCommand = { if (response.data.neverhaveiever) { let i = guildDb.customMessages.filter( - (e) => e.type === "neverhaveiever" + (e) => e.type === "neverhaveiever", ).length; response.data.neverhaveiever.map((d: any) => { if (prem.length > 0 && i === 100) return; @@ -867,7 +867,7 @@ const command: ChatInputCommand = { if (response.data.wwyd) { let i = guildDb.customMessages.filter( - (e) => e.type === "wwyd" + (e) => e.type === "wwyd", ).length; response.data.wwyd.map((d: any) => { if (prem.length > 0 && i === 100) return; @@ -888,7 +888,7 @@ const command: ChatInputCommand = { ...guildDb, customMessages: guildDb.customMessages, }, - true + true, ); if (all.length > 0) return; @@ -898,7 +898,7 @@ const command: ChatInputCommand = { }, content: client.translation.get( guildDb?.language, - "wyCustom.success.import" + "wyCustom.success.import", ), }); return; @@ -906,7 +906,7 @@ const command: ChatInputCommand = { .catch((err) => { captureException(err); interaction.editReply( - `${client.translation.get(guildDb?.language, "wyCustom.error.import.att15")}\n\nError: ${err}` + `${client.translation.get(guildDb?.language, "wyCustom.error.import.att15")}\n\nError: ${err}`, ); return; }); @@ -918,7 +918,7 @@ const command: ChatInputCommand = { ephemeral: true, content: client.translation.get( guildDb?.language, - "wyCustom.error.export.none" + "wyCustom.error.export.none", ), }); return; @@ -927,18 +927,18 @@ const command: ChatInputCommand = { await interaction.deferReply(); const wouldyourather = guildDb.customMessages.filter( - (c) => c.type === "wouldyourather" + (c) => c.type === "wouldyourather", ); const truth = guildDb.customMessages.filter( - (c) => c.type === "truth" + (c) => c.type === "truth", ); const dare = guildDb.customMessages.filter((c) => c.type === "dare"); const neverhaveiever = guildDb.customMessages.filter( - (c) => c.type === "neverhaveiever" + (c) => c.type === "neverhaveiever", ); const wwyd = guildDb.customMessages.filter((c) => c.type === "wwyd"); const topic = guildDb.customMessages.filter( - (c) => c.type === "topic" + (c) => c.type === "topic", ); let text = "{\n"; @@ -1011,7 +1011,7 @@ const command: ChatInputCommand = { interaction.editReply({ content: client.translation.get( guildDb?.language, - "wyCustom.success.export" + "wyCustom.success.export", ), files: [ { @@ -1033,9 +1033,9 @@ const command: ChatInputCommand = { ? client.translation.get( guildDb?.language, "Language.embed.errorRole", - { role: `<@&${guildDb.customPerm}>` } + { role: `<@&${guildDb.customPerm}>` }, ) - : client.translation.get(guildDb?.language, "Language.embed.error") + : client.translation.get(guildDb?.language, "Language.embed.error"), ); interaction .reply({ diff --git a/src/commands/settings/settings-subcommands/qotd.ts b/src/commands/settings/settings-subcommands/qotd.ts index c4c96a32..d0169898 100644 --- a/src/commands/settings/settings-subcommands/qotd.ts +++ b/src/commands/settings/settings-subcommands/qotd.ts @@ -12,36 +12,36 @@ import type WouldYou from "../../../util/wouldYou"; export default async function settingsGeneral( interaction: ChatInputCommandInteraction, client: WouldYou, - guildDb: IGuildModel + guildDb: IGuildModel, ) { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.dailyTitle") + client.translation.get(guildDb?.language, "Settings.embed.dailyTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.dailyChannel" + "Settings.embed.dailyChannel", )}: ${guildDb.dailyChannel ? `<#${guildDb.dailyChannel}>` : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyRole" + "Settings.embed.dailyRole", )}: ${guildDb.dailyRole ? `<@&${guildDb.dailyRole}>` : ":x:"}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyType")}: ${guildDb?.customTypes}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyTimezone")}: ${guildDb.dailyTimezone}\n` + `${client.translation.get(guildDb?.language, "Settings.embed.dailyInterval")}: ${guildDb.dailyInterval}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyThread" + "Settings.embed.dailyThread", )}: ${guildDb.dailyThread ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.autoPin" + "Settings.embed.autoPin", )}: ${guildDb.autoPin ? ":white_check_mark:" : ":x:"}\n` + `${client.translation.get( guildDb?.language, - "Settings.embed.dailyMsg" - )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}` + "Settings.embed.dailyMsg", + )}: ${guildDb.dailyMsg ? ":white_check_mark:" : ":x:"}`, ) .setColor("#0598F6"); @@ -55,26 +55,32 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyChannel" - ) + "Settings.button.dailyChannel", + ), ) .setStyle( - guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyChannel ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyRole") .setEmoji("1185973666811478117") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.dailyRole") + client.translation.get( + guildDb?.language, + "Settings.button.dailyRole", + ), ) .setStyle( - guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary + guildDb.dailyRole ? ButtonStyle.Primary : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyType") .setEmoji("1185973664538177557") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.dailyType") + client.translation.get( + guildDb?.language, + "Settings.button.dailyType", + ), ) .setStyle(ButtonStyle.Primary), new ButtonBuilder() @@ -83,10 +89,10 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyQuestionType" - ) + "Settings.button.dailyQuestionType", + ), ) - .setStyle(ButtonStyle.Primary) + .setStyle(ButtonStyle.Primary), ); // Second button row @@ -99,11 +105,11 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyTimezone" - ) + "Settings.button.dailyTimezone", + ), ) .setStyle( - guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyTimezone ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyInterval") @@ -111,19 +117,22 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyInterval" - ) + "Settings.button.dailyInterval", + ), ) .setStyle( - guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyInterval ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("daySelection") .setEmoji("1220826970133368842") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.daySelect") + client.translation.get( + guildDb?.language, + "Settings.button.daySelect", + ), ) - .setStyle(ButtonStyle.Success) + .setStyle(ButtonStyle.Success), ); // Third button row @@ -136,30 +145,30 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.dailyThread" - ) + "Settings.button.dailyThread", + ), ) .setStyle( - guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.dailyThread ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("autoPin") .setEmoji("1189521962318450698") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.autoPin") + client.translation.get(guildDb?.language, "Settings.button.autoPin"), ) .setStyle( - guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary + guildDb.autoPin ? ButtonStyle.Success : ButtonStyle.Secondary, ), new ButtonBuilder() .setCustomId("dailyMsg") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.dailyMsg") + client.translation.get(guildDb?.language, "Settings.button.dailyMsg"), ) .setStyle( - guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.dailyMsg ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await interaction diff --git a/src/commands/settings/settings-subcommands/utility.ts b/src/commands/settings/settings-subcommands/utility.ts index 8ec87566..dd67688a 100644 --- a/src/commands/settings/settings-subcommands/utility.ts +++ b/src/commands/settings/settings-subcommands/utility.ts @@ -16,22 +16,22 @@ export default async function settingsGeneral( ) { const emb = new EmbedBuilder() .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.utilityTitle") + client.translation.get(guildDb?.language, "Settings.embed.utilityTitle"), ) .setDescription( `${client.translation.get( guildDb?.language, - "Settings.embed.customPerm" + "Settings.embed.customPerm", )}: ${guildDb.customPerm ? `<@&${guildDb.customPerm}>` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.username" + "Settings.embed.username", )}: ${guildDb.webhookName ? guildDb.webhookName : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.avatar" + "Settings.embed.avatar", )}: ${guildDb.webhookAvatar ? `[Image](<${guildDb.webhookAvatar}>)` : ":x:"}\n${client.translation.get( guildDb?.language, - "Settings.embed.classicMode" - )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}` + "Settings.embed.classicMode", + )}: ${guildDb.classicMode ? ":x:" : ":white_check_mark:"}`, ) .setColor("#0598F6") .setFooter({ @@ -45,18 +45,18 @@ export default async function settingsGeneral( .setCustomId("webhookName") .setEmoji("1185973660465500180") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.name") + client.translation.get(guildDb?.language, "Settings.button.name"), ) .setStyle(ButtonStyle.Success), new ButtonBuilder() .setCustomId("webhookAvatar") .setEmoji("1207801424503644260") .setLabel( - client.translation.get(guildDb?.language, "Settings.button.avatar") + client.translation.get(guildDb?.language, "Settings.button.avatar"), ) .setStyle( - guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.webhookAvatar ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); const button2 = @@ -67,11 +67,11 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.classicMode" - ) + "Settings.button.classicMode", + ), ) .setStyle( - guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success + guildDb.classicMode ? ButtonStyle.Secondary : ButtonStyle.Success, ), new ButtonBuilder() .setCustomId("customPerm") @@ -79,12 +79,12 @@ export default async function settingsGeneral( .setLabel( client.translation.get( guildDb?.language, - "Settings.button.customPerm" - ) + "Settings.button.customPerm", + ), ) .setStyle( - guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary - ) + guildDb.customPerm ? ButtonStyle.Success : ButtonStyle.Secondary, + ), ); await interaction.reply({ diff --git a/src/commands/settings/settings-subcommands/welcomes.ts b/src/commands/settings/settings-subcommands/welcomes.ts index c65d1bb5..11d1423c 100644 --- a/src/commands/settings/settings-subcommands/welcomes.ts +++ b/src/commands/settings/settings-subcommands/welcomes.ts @@ -12,7 +12,7 @@ import type WouldYou from "../../../util/wouldYou"; export default async function settingsGeneral( interaction: ChatInputCommandInteraction, client: WouldYou, - guildDb: IGuildModel + guildDb: IGuildModel, ) { const truncateString = (str: string, maxLength: number) => { const cleanedStr = str.replace(/\n/g, " "); @@ -22,148 +22,165 @@ export default async function settingsGeneral( }; try { + const welcomeEmbed = new EmbedBuilder() + .setTitle( + client.translation.get( + guildDb?.language, + "Settings.embed.welcomeTitle", + ), + ) + .setDescription( + `${client.translation.get( + guildDb?.language, + "Settings.embed.welcome", + )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.welcomePing", + )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.dailyType", + )}: ${guildDb.welcomeType}\n${client.translation.get( + guildDb?.language, + "Settings.embed.welcomeChannel", + )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( + guildDb?.language, + "Settings.embed.welcomeMessage", + )}: ${ + guildDb.welcomeMessage + ? truncateString(guildDb.welcomeMessage, 100) + : ":x:" + }`, + ) + .setColor("#0598F6") + .setFooter({ + text: client.translation.get( + guildDb?.language, + "Settings.embed.footer", + ), + iconURL: client?.user?.displayAvatarURL() || undefined, + }); - const welcomeEmbed = new EmbedBuilder() - .setTitle( - client.translation.get(guildDb?.language, "Settings.embed.welcomeTitle") - ) - .setDescription( - `${client.translation.get( - guildDb?.language, - "Settings.embed.welcome" - )}: ${guildDb.welcome ? ":white_check_mark:" : ":x:"}\n${client.translation.get( - guildDb?.language, - "Settings.embed.welcomePing" - )}: ${guildDb.welcomePing ? ":white_check_mark:" : ":x:"}\n${client.translation.get( - guildDb?.language, - "Settings.embed.dailyType" - )}: ${guildDb.welcomeType}\n${client.translation.get( - guildDb?.language, - "Settings.embed.welcomeChannel" - )}: ${guildDb.welcomeChannel ? `<#${guildDb.welcomeChannel}>` : ":x:"}\n${client.translation.get( - guildDb?.language, - "Settings.embed.welcomeMessage" - )}: ${ - guildDb.welcomeMessage - ? truncateString(guildDb.welcomeMessage, 100) - : ":x:" - }` - ) - .setColor("#0598F6") - .setFooter({ - text: client.translation.get(guildDb?.language, "Settings.embed.footer"), - iconURL: client?.user?.displayAvatarURL() || undefined, - }); - - // First button row - // Deals with toggles - const welcomeButtons1 = - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("welcomeType") - .setEmoji("1185973664538177557") - .setLabel( - client.translation.get(guildDb?.language, "Settings.button.dailyType") - ) - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("welcomeChannel") - .setEmoji("1185973667973320775") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomeChannel" + // First button row + // Deals with toggles + const welcomeButtons1 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("welcomeType") + .setEmoji("1185973664538177557") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.dailyType", + ), ) - ) - .setStyle( - guildDb.welcomeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary - ), - new ButtonBuilder() - .setCustomId("welcomeTest") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomeTest" + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomeChannel") + .setEmoji("1185973667973320775") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeChannel", + ), + ) + .setStyle( + guildDb.welcomeChannel + ? ButtonStyle.Primary + : ButtonStyle.Secondary, + ), + new ButtonBuilder() + .setCustomId("welcomeTest") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeTest", + ), ) - ) - .setDisabled(guildDb.welcomeChannel && guildDb?.welcome ? false : true) - .setStyle( - guildDb.welcomeChannel && guildDb?.welcome - ? ButtonStyle.Primary - : ButtonStyle.Secondary - ) - .setEmoji("1207800685928910909") - ); + .setDisabled( + guildDb.welcomeChannel && guildDb?.welcome ? false : true, + ) + .setStyle( + guildDb.welcomeChannel && guildDb?.welcome + ? ButtonStyle.Primary + : ButtonStyle.Secondary, + ) + .setEmoji("1207800685928910909"), + ); - // Second button row - // Deals with type, channel, test - const welcomeButtons2 = - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("welcome") - .setEmoji("1185973660465500180") - .setLabel( - client.translation.get(guildDb?.language, "Settings.button.welcome") - ) - .setStyle( - guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary - ), - new ButtonBuilder() - .setCustomId("welcomePing") - .setEmoji("1185973660465500180") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomePing" + // Second button row + // Deals with type, channel, test + const welcomeButtons2 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("welcome") + .setEmoji("1185973660465500180") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcome", + ), ) - ) - .setStyle( - guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary - ) - ); + .setStyle( + guildDb.welcome ? ButtonStyle.Success : ButtonStyle.Secondary, + ), + new ButtonBuilder() + .setCustomId("welcomePing") + .setEmoji("1185973660465500180") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePing", + ), + ) + .setStyle( + guildDb.welcomePing ? ButtonStyle.Success : ButtonStyle.Secondary, + ), + ); - const welcomeButtons3 = - new ActionRowBuilder().addComponents( - new ButtonBuilder() - .setCustomId("welcomeMessage") - .setEmoji("1207801424503644260") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomeMessage" + const welcomeButtons3 = + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setCustomId("welcomeMessage") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeMessage", + ), ) - ) - .setStyle( - guildDb.welcomeMessage ? ButtonStyle.Primary : ButtonStyle.Secondary - ), - new ButtonBuilder() - .setCustomId("welcomeEmbedEdit") - .setEmoji("1308673732478238740") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomeEmbedEdit" + .setStyle( + guildDb.welcomeMessage + ? ButtonStyle.Primary + : ButtonStyle.Secondary, + ), + new ButtonBuilder() + .setCustomId("welcomeEmbedEdit") + .setEmoji("1308673732478238740") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomeEmbedEdit", + ), ) - ) - .setStyle(ButtonStyle.Primary), - new ButtonBuilder() - .setCustomId("welcomePlaceholders") - .setEmoji("1207801424503644260") - .setLabel( - client.translation.get( - guildDb?.language, - "Settings.button.welcomePlaceholders" + .setStyle(ButtonStyle.Primary), + new ButtonBuilder() + .setCustomId("welcomePlaceholders") + .setEmoji("1207801424503644260") + .setLabel( + client.translation.get( + guildDb?.language, + "Settings.button.welcomePlaceholders", + ), ) - ) - .setStyle(ButtonStyle.Primary) - ); + .setStyle(ButtonStyle.Primary), + ); - await interaction.reply({ - embeds: [welcomeEmbed], - components: [welcomeButtons2, welcomeButtons1, welcomeButtons3], - ephemeral: true, - }); + await interaction.reply({ + embeds: [welcomeEmbed], + components: [welcomeButtons2, welcomeButtons1, welcomeButtons3], + ephemeral: true, + }); } catch (e) { - console.log(e) + console.log(e); } } diff --git a/src/commands/utility/info.ts b/src/commands/utility/info.ts index d7543d19..db0030f8 100644 --- a/src/commands/utility/info.ts +++ b/src/commands/utility/info.ts @@ -23,11 +23,11 @@ const command: ChatInputCommand = { execute: async (interaction, client, guildDb) => { const serverCount = await client.cluster.broadcastEval( - (c) => c.guilds.cache.size + (c) => c.guilds.cache.size, ); const userCount = await client.cluster.broadcastEval((c) => - c.guilds.cache.reduce((a, b) => a + b.memberCount, 0) + c.guilds.cache.reduce((a, b) => a + b.memberCount, 0), ); const ramUsage = await client.cluster.broadcastEval(() => { @@ -80,13 +80,13 @@ ${await shardClusterStoreModel groups[groupIndex] += (groups[groupIndex] ? ", " : "") + shard; return groups; }, - [] + [], ); return `[Cluster ${clusterId}]\n${shardGroups.join("\n")}`; }) .join("\n\n"); - }, "") + }, ""), ) .catch(() => "No Shard Data found")} \`\`\` @@ -96,7 +96,7 @@ ${await shardClusterStoreModel -# [Invite Link](https://wouldyoubot.gg/invite) -# [Privacy Policy](https://wouldyoubot.gg/privacy) -# [Terms of Service](https://wouldyoubot.gg/terms) --# [Legal](https://wouldyoubot.gg/legal)` +-# [Legal](https://wouldyoubot.gg/legal)`, ) .setFooter({ text: `Premium Status: ${premium.result ? premium.rawType : "Free"}`, diff --git a/src/commands/utility/placeholders.ts b/src/commands/utility/placeholders.ts index 4adc5a95..0d6e8915 100644 --- a/src/commands/utility/placeholders.ts +++ b/src/commands/utility/placeholders.ts @@ -1,7 +1,7 @@ import { captureException } from "@sentry/node"; import { EmbedBuilder, - type GuildMember, + type GuildMember, SlashCommandBuilder, } from "discord.js"; import type { ChatInputCommand } from "../../interfaces"; @@ -11,43 +11,54 @@ const command: ChatInputCommand = { cooldown: true, data: new SlashCommandBuilder() .setName("placeholders") - .setDescription("Gives you a list of placeholders that you can use in your welcome messages") + .setDescription( + "Gives you a list of placeholders that you can use in your welcome messages", + ) .setContexts([0]) .setIntegrationTypes([0]) .setDescriptionLocalizations({ de: "Gibt dir eine Liste von Platzhaltern, die du in deinen Willkommensnachrichten verwenden kannst", - "es-ES": "Te da una lista de marcadores de posición que puedes usar en tus mensajes de bienvenida", + "es-ES": + "Te da una lista de marcadores de posición que puedes usar en tus mensajes de bienvenida", fr: "Vous donne une liste de placeholders que vous pouvez utiliser dans vos messages de bienvenue", it: "Ti fornisce un elenco di segnaposto che puoi utilizzare nei tuoi messaggi di benvenuto", }), execute: async (interaction, client, guildDb) => { - const member = interaction.member as GuildMember; const placeholderMap: Record = { "{{user_displayname}}": member.user.displayName, "{{user_tag}}": member.user.username, - "{{user_avatarUrl}}": member.user.avatarURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{user_avatarUrl}}": + member.user.avatarURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", "{{@mention}}": `<@${member.user.id}>`, "{{guild_name}}": member.guild.name, "{{guild_member_count}}": member.guild.memberCount.toString(), - "{{guild_iconUrl}}": member.guild.iconURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", - "{{question}}": client.translation.get(guildDb.language, "Placeholders.embed.question"), + "{{guild_iconUrl}}": + member.guild.iconURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", + "{{question}}": client.translation.get( + guildDb.language, + "Placeholders.embed.question", + ), "{{new_line}}": "\\n", }; const placeholderEmbed = new EmbedBuilder() .setColor("#0598F6") - .setTitle(client.translation.get(guildDb.language, "Placeholders.embed.title")) - .addFields( + .setTitle( + client.translation.get(guildDb.language, "Placeholders.embed.title"), + ) + .addFields( ...Object.entries(placeholderMap).map(([placeholder, value]) => ({ - name: placeholder, - value: value, - inline: false, - })), + name: placeholder, + value: value, + inline: false, + })), ); - + await interaction .reply({ embeds: [placeholderEmbed], diff --git a/src/commands/utility/sync.ts b/src/commands/utility/sync.ts index c89aef54..eab17c4b 100644 --- a/src/commands/utility/sync.ts +++ b/src/commands/utility/sync.ts @@ -35,7 +35,7 @@ const command: ChatInputCommand = { ephemeral: true, }); } - + const subscription = await stripe.subscriptions.search({ query: `metadata['serverId']:'${interaction.guildId}'`, }); diff --git a/src/commands/utility/vote.ts b/src/commands/utility/vote.ts index e3530303..03ef353c 100644 --- a/src/commands/utility/vote.ts +++ b/src/commands/utility/vote.ts @@ -24,20 +24,24 @@ const command: ChatInputCommand = { }), execute: async (interaction, client, guildDb) => { - const { topgg } = client.config.emojis.vote - + const { topgg } = client.config.emojis.vote; + const voteEmbed = new EmbedBuilder() .setAuthor({ name: client.translation.get(guildDb?.language, "Vote.embed.name"), iconURL: `https://cdn.discordapp.com/emojis/${topgg}.webp?size=512&quality=lossless`, }) .setColor("#FF3366") - .setDescription(client.translation.get(guildDb?.language, "Vote.embed.description"),) + .setDescription( + client.translation.get(guildDb?.language, "Vote.embed.description"), + ); const button = new ActionRowBuilder().addComponents( new ButtonBuilder() - .setLabel(client.translation.get(guildDb?.language, "Vote.button.label"),) + .setLabel( + client.translation.get(guildDb?.language, "Vote.button.label"), + ) .setStyle(5) .setEmoji(topgg) .setURL("https://top.gg/bot/981649513427111957/vote/"), diff --git a/src/config.ts b/src/config.ts index b94ab878..c7d09a41 100644 --- a/src/config.ts +++ b/src/config.ts @@ -17,8 +17,8 @@ const Config = { woofer: "<:Woofer:1321568826458116267>", }, vote: { - topgg: "1326947352409276438" - } + topgg: "1326947352409276438", + }, }, } as const; diff --git a/src/events/guildCreate.ts b/src/events/guildCreate.ts index fb7f7ba4..8ddeb11a 100644 --- a/src/events/guildCreate.ts +++ b/src/events/guildCreate.ts @@ -47,10 +47,16 @@ const event: Event = { .addFields( { name: "Name", value: guild.name, inline: false }, { name: "ID", value: guild.id, inline: false }, - { name: "Users", value: guild.memberCount.toLocaleString(), inline: false }, + { + name: "Users", + value: guild.memberCount.toLocaleString(), + inline: false, + }, { name: "Server Owner", value: guild.ownerId, inline: false }, - ...(features ? [{ name: "Features", value: features, inline: false }] : []) - ) + ...(features + ? [{ name: "Features", value: features, inline: false }] + : []), + ), ], allowedMentions: { parse: [] }, }); diff --git a/src/events/guildDelete.ts b/src/events/guildDelete.ts index e93e78c7..8689659a 100644 --- a/src/events/guildDelete.ts +++ b/src/events/guildDelete.ts @@ -58,10 +58,16 @@ const event: Event = { .addFields([ { name: "Name", value: guild.name, inline: false }, { name: "ID", value: guild.id, inline: false }, - { name: "Users", value: guild.memberCount.toLocaleString(), inline: false }, + { + name: "Users", + value: guild.memberCount.toLocaleString(), + inline: false, + }, { name: "Server Owner", value: guild.ownerId, inline: false }, - ...(features ? [{ name: "Features", value: features, inline: false }] : []), - ]) + ...(features + ? [{ name: "Features", value: features, inline: false }] + : []), + ]), ], allowedMentions: { parse: [] }, }); diff --git a/src/events/guildMemberAdd.ts b/src/events/guildMemberAdd.ts index fe25d891..be8527c3 100644 --- a/src/events/guildMemberAdd.ts +++ b/src/events/guildMemberAdd.ts @@ -40,7 +40,8 @@ const event: Event = { const premium = await client.premium.check(member?.guild.id); - const randomType = Math.random() > 0.5 ? "wouldyourather" : "whatwouldyoudo"; + const randomType = + Math.random() > 0.5 ? "wouldyourather" : "whatwouldyoudo"; const randomMessage = await await getQuestionsByType( guildDb.welcomeChannel, @@ -48,17 +49,21 @@ const event: Event = { guildDb, guildDb?.language != null ? guildDb.language : "en_EN", premium.result, - false + false, ); const placeholderMap: Record = { "{{user_displayname}}": member.user.displayName, "{{user_tag}}": member.user.username, - "{{user_avatarUrl}}": member.user.avatarURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{user_avatarUrl}}": + member.user.avatarURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", "{{@mention}}": `<@${member.user.id}>`, "{{guild_name}}": member.guild.name, "{{guild_member_count}}": member.guild.memberCount.toString(), - "{{guild_iconUrl}}": member.guild.iconURL() ?? "https://cdn.discordapp.com/embed/avatars/5.png", + "{{guild_iconUrl}}": + member.guild.iconURL() ?? + "https://cdn.discordapp.com/embed/avatars/5.png", "{{question}}": randomMessage.question, "{{new_line}}": "\n", }; @@ -68,7 +73,7 @@ const event: Event = { (msg, [placeholder, value]) => { return msg.replace(new RegExp(placeholder, "g"), value); }, - message + message, ); } @@ -83,13 +88,15 @@ const event: Event = { const embed = new EmbedBuilder() .setColor((guildDb.welcomeEmbedColor as ColorResolvable) || null) .setTitle( - guildDb?.welcomeEmbedTitle ? Message(guildDb.welcomeEmbedTitle) : null + guildDb?.welcomeEmbedTitle + ? Message(guildDb.welcomeEmbedTitle) + : null, ) .setURL(guildDb.welcomeEmbedTitleURL || null) .setDescription( guildDb?.welcomeEmbedDescription ? Message(guildDb.welcomeEmbedDescription) - : null + : null, ) .setThumbnail(guildDb.welcomeEmbedThumbnail || null) .setImage(guildDb.welcomeEmbedImage || null) diff --git a/src/util/Functions/fileToCollection.ts b/src/util/Functions/fileToCollection.ts index 932d5c9c..e7ba218f 100644 --- a/src/util/Functions/fileToCollection.ts +++ b/src/util/Functions/fileToCollection.ts @@ -16,16 +16,18 @@ export async function fileToCollection< if (dirent.isDirectory()) { processDirectory(fullPath); } else if (dirent.isFile() && dirent.name.endsWith(".js")) { - const importPromise = import(fullPath).then((resp: { default: Type }) => { - const key = getKey(resp.default); - if (key) { - collection.set(key, resp.default); - } else { - console.warn(`Could not determine key for file: ${fullPath}`); - } - }).catch(error => { - console.error(`Error importing file ${fullPath}:`, error); - }); + const importPromise = import(fullPath) + .then((resp: { default: Type }) => { + const key = getKey(resp.default); + if (key) { + collection.set(key, resp.default); + } else { + console.warn(`Could not determine key for file: ${fullPath}`); + } + }) + .catch((error) => { + console.error(`Error importing file ${fullPath}:`, error); + }); promises.push(importPromise); } } diff --git a/src/util/Functions/jsonImport.ts b/src/util/Functions/jsonImport.ts index ce693d04..f82b5446 100644 --- a/src/util/Functions/jsonImport.ts +++ b/src/util/Functions/jsonImport.ts @@ -100,7 +100,7 @@ export async function getRandomTod( guildDb: IGuildModel, language: string, premium: boolean, - enabled = true + enabled = true, ): Promise { const truth = await getQuestionsByType( channel, @@ -108,7 +108,7 @@ export async function getRandomTod( guildDb, language, premium, - enabled + enabled, ); const dare = await getQuestionsByType( channel, @@ -116,7 +116,7 @@ export async function getRandomTod( guildDb, language, premium, - enabled + enabled, ); return Math.random() < 0.5 ? truth : dare; @@ -128,7 +128,7 @@ export async function getQuestionsByType( guildDb: IGuildModel, language: string, premium: boolean, - enabled = true + enabled = true, ): Promise { if (!validTypes.includes(type)) { return Promise.reject("Invalid type"); @@ -250,13 +250,13 @@ export async function getQuestionsByType( ]); const randomIndex = Math.floor( - Math.random() * allCustomQuestions.length + Math.random() * allCustomQuestions.length, ); return [allCustomQuestions[randomIndex]]; } const randomIndex = Math.floor( - Math.random() * availableCustomQuestions.length + Math.random() * availableCustomQuestions.length, ); return [availableCustomQuestions[randomIndex]]; } @@ -276,7 +276,7 @@ export async function getQuestionsByType( const customQuestion = await getRandomCustom( premium && enabled ? usedQuestions[0]?.[typeCheck[`custom${type}`]] || [] - : [] + : [], ); if (!customQuestion?.[0]) { @@ -286,7 +286,7 @@ export async function getQuestionsByType( if (premium && enabled) { await usedQuestionModel.updateOne( { guildID: guildDb.guildID }, - { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } } + { $push: { [typeCheck[`custom${type}`]]: customQuestion[0].id } }, ); } @@ -298,7 +298,7 @@ export async function getQuestionsByType( // Only get normal questions if there are no custom questions configured let questionDatabase = await getDBQuestion( - premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [] + premium && enabled ? usedQuestions[0]?.[typeCheck[type]] || [] : [], ); if (!questionDatabase[0]?.id && premium && enabled) { @@ -316,7 +316,7 @@ export async function getQuestionsByType( if (premium && enabled) { await usedQuestionModel.updateOne( { guildID: guildDb.guildID }, - { $push: { [typeCheck[type]]: dbQuestion.id } } + { $push: { [typeCheck[type]]: dbQuestion.id } }, ); } @@ -341,7 +341,7 @@ export async function getQuestionsByType( break; case "mixed": { const availableQuestions = questionDatabase.map( - (q: any) => ({ ...q }) as QuestionData + (q: any) => ({ ...q }) as QuestionData, ); const mixedQuestions = shuffle(availableQuestions); const question = mixedQuestions[0] as QuestionData; @@ -392,7 +392,7 @@ export async function reset( type: Quest, customType: string, guildID: string, - resetType: string + resetType: string, ): Promise { let selectedModel: string; if (customType === "custom") { @@ -410,6 +410,6 @@ export async function reset( $set: { [selectedModel]: [], }, - } + }, ); } diff --git a/src/util/Models/guildModel.ts b/src/util/Models/guildModel.ts index 21c595ed..9d00aa8e 100644 --- a/src/util/Models/guildModel.ts +++ b/src/util/Models/guildModel.ts @@ -174,7 +174,7 @@ const guildProfileSchema = new Schema( }, dailyQuestionType: { type: [String], - default: ['wyrModel', 'wwydModel', 'nhieModel'], + default: ["wyrModel", "wwydModel", "nhieModel"], }, dailyTimezone: { type: String, @@ -296,10 +296,10 @@ const guildProfileSchema = new Schema( default: null, }, }, - { timestamps: true } + { timestamps: true }, ); export const GuildModel = model( "guildProfile", - guildProfileSchema + guildProfileSchema, ); diff --git a/src/util/Models/zod/welcomeEmbed.ts b/src/util/Models/zod/welcomeEmbed.ts index bfb0998c..927633ea 100644 --- a/src/util/Models/zod/welcomeEmbed.ts +++ b/src/util/Models/zod/welcomeEmbed.ts @@ -18,14 +18,18 @@ const welcomeEmbedSchema = z.object({ .max(100, "Make sure your author name is only 100 characters long"), url: z.string().url(), }), - thumbnail: z.union([ - z.string().url(), - z.enum(['{{user_avatarUrl}}', '{{guild_iconUrl}}']) - ]).optional(), - image: z.union([ - z.string().url(), - z.enum(['{{user_avatarUrl}}', '{{guild_iconUrl}}']) - ]).optional(), + thumbnail: z + .union([ + z.string().url(), + z.enum(["{{user_avatarUrl}}", "{{guild_iconUrl}}"]), + ]) + .optional(), + image: z + .union([ + z.string().url(), + z.enum(["{{user_avatarUrl}}", "{{guild_iconUrl}}"]), + ]) + .optional(), footer: z.object({ text: z .string() @@ -33,7 +37,7 @@ const welcomeEmbedSchema = z.object({ .max(100, "Make sure your footer text is only 100 characters long"), iconURL: z.union([ z.string().url(), - z.enum(['{{user_avatarUrl}}', '{{guild_iconUrl}}']) + z.enum(["{{user_avatarUrl}}", "{{guild_iconUrl}}"]), ]), }), color: z diff --git a/src/util/dailyMessage.ts b/src/util/dailyMessage.ts index a6e2cc26..2ac9a27c 100644 --- a/src/util/dailyMessage.ts +++ b/src/util/dailyMessage.ts @@ -15,10 +15,10 @@ export default class DailyMessage { * Start the daily message Schedule */ async listen() { - let username = process.env.RABBITMQ_DEFAULT_USER! - let password = process.env.RABBITMQ_DEFAULT_PASS! - username = encodeURIComponent(username) - password = encodeURIComponent(password) + let username = process.env.RABBITMQ_DEFAULT_USER!; + let password = process.env.RABBITMQ_DEFAULT_PASS!; + username = encodeURIComponent(username); + password = encodeURIComponent(password); const URI = process.env.RABBITMQ_URL!; const connection = await amqplib.connect(URI, { diff --git a/src/util/keepAlive.ts b/src/util/keepAlive.ts index 674bc5af..73ea6203 100644 --- a/src/util/keepAlive.ts +++ b/src/util/keepAlive.ts @@ -16,10 +16,10 @@ export default class KeepAlive { this.client.rest.on("rateLimited", (log) => { const { route: path, limit, timeToReset: timeout } = log; captureMessage( - `Rate limited on ${path} with a limit of ${limit} and a timeout of ${timeout}` + `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}` + `Rate limited on ${path} with a limit of ${limit} and a timeout of ${timeout}`, ); });