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.`)); } }; diff --git a/src/helpers/baseEmbeds/index.ts b/src/helpers/baseEmbeds/index.ts new file mode 100644 index 0000000..5e7b94a --- /dev/null +++ b/src/helpers/baseEmbeds/index.ts @@ -0,0 +1,35 @@ +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); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(successColor) + .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); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(waitColor) + .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); + + return new EmbedBuilder() + .setTimestamp(new Date()) + .setTitle(title) + .setColor(errorColor) + .setFooter({ text: footerText, iconURL: footerIcon }); +};