Merge pull request #454 from VermiumSifell/dev-2022.11.01

Fix a bug around dev guild commands and added an helper to reduce duplicated code for embed builders
This commit is contained in:
Axel Olausson Holtenäs 2022-10-22 16:04:52 +02:00 committed by GitHub
commit b570e8ec7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 6 deletions

View file

@ -26,15 +26,13 @@ export default async (client: Client) => {
throw new Error(`Could not gather command list: ${error}`); throw new Error(`Could not gather command list: ${error}`);
}); });
await client.application?.commands await client.application?.commands.set(commandList).then(() => {
.set(commandList, process.env.DISCORD_GUILD_ID) logger.info(`Finished updating command list.`);
.then(() => { });
logger.info(`Finished updating command list.`);
});
if (process.env.NODE_ENV !== "production") { if (process.env.NODE_ENV !== "production") {
await client.application?.commands await client.application?.commands
.set(commandList) .set(commandList, process.env.DISCORD_GUILD_ID)
.then(() => logger.info(`Finished updating guild command list.`)); .then(() => logger.info(`Finished updating guild command list.`));
} }
}; };

View file

@ -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 });
};