From 1b4c77603730428effd3a4b22f44fb5bee7b4a3e Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sat, 22 Oct 2022 15:57:30 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Add=20h?= =?UTF-8?q?elper,=20reduce=20duplicated=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helpers/baseEmbeds/index.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/helpers/baseEmbeds/index.ts diff --git a/src/helpers/baseEmbeds/index.ts b/src/helpers/baseEmbeds/index.ts new file mode 100644 index 0000000..9319039 --- /dev/null +++ b/src/helpers/baseEmbeds/index.ts @@ -0,0 +1,32 @@ +import { EmbedBuilder, Guild } from "discord.js"; +import getEmbedData from "../getEmbedData"; + +export const success = async (guild: Guild | null, title: string) => { + const { successColor, footerText, footerIcon } = await getEmbedData(guild); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(successColor) + .setFooter({ text: footerText, iconURL: footerIcon }); +}; + +export const wait = async (guild: Guild | null, title: string) => { + const { waitColor, footerText, footerIcon } = await getEmbedData(guild); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(waitColor) + .setFooter({ text: footerText, iconURL: footerIcon }); +}; + +export const error = async (guild: Guild | null, title: string) => { + const { errorColor, footerText, footerIcon } = await getEmbedData(guild); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(errorColor) + .setFooter({ text: footerText, iconURL: footerIcon }); +}; From 74c94b467f7b214e7288521ef4b76967dec816ff Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sat, 22 Oct 2022 15:59:36 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A9=B9=20dev=20guild=20commands=20now?= =?UTF-8?q?=20working=20as=20expected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handlers/deployCommands/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/handlers/deployCommands/index.ts b/src/handlers/deployCommands/index.ts index 4b30c96..7e63c4e 100644 --- a/src/handlers/deployCommands/index.ts +++ b/src/handlers/deployCommands/index.ts @@ -26,15 +26,13 @@ export default async (client: Client) => { throw new Error(`Could not gather command list: ${error}`); }); - await client.application?.commands - .set(commandList, process.env.DISCORD_GUILD_ID) - .then(() => { - logger.info(`Finished updating command list.`); - }); + await client.application?.commands.set(commandList).then(() => { + logger.info(`Finished updating command list.`); + }); if (process.env.NODE_ENV !== "production") { await client.application?.commands - .set(commandList) + .set(commandList, process.env.DISCORD_GUILD_ID) .then(() => logger.info(`Finished updating guild command list.`)); } }; From 3c49580831b7627191d8211070fb0256e39e239f Mon Sep 17 00:00:00 2001 From: Vermium Sifell Date: Sat, 22 Oct 2022 16:03:37 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=92=A1=20Add=20comment=20for=20baseEm?= =?UTF-8?q?beds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helpers/baseEmbeds/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/helpers/baseEmbeds/index.ts b/src/helpers/baseEmbeds/index.ts index 9319039..5e7b94a 100644 --- a/src/helpers/baseEmbeds/index.ts +++ b/src/helpers/baseEmbeds/index.ts @@ -1,6 +1,7 @@ import { EmbedBuilder, Guild } from "discord.js"; import getEmbedData from "../getEmbedData"; +// Construct a base embed for success messages export const success = async (guild: Guild | null, title: string) => { const { successColor, footerText, footerIcon } = await getEmbedData(guild); @@ -11,6 +12,7 @@ export const success = async (guild: Guild | null, title: string) => { .setFooter({ text: footerText, iconURL: footerIcon }); }; +// Construct a base embed for wait messages export const wait = async (guild: Guild | null, title: string) => { const { waitColor, footerText, footerIcon } = await getEmbedData(guild); @@ -21,6 +23,7 @@ export const wait = async (guild: Guild | null, title: string) => { .setFooter({ text: footerText, iconURL: footerIcon }); }; +// Construct a base embed for error messages export const error = async (guild: Guild | null, title: string) => { const { errorColor, footerText, footerIcon } = await getEmbedData(guild);