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:
commit
b570e8ec7d
2 changed files with 39 additions and 6 deletions
|
@ -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.`));
|
||||
}
|
||||
};
|
||||
|
|
35
src/helpers/baseEmbeds/index.ts
Normal file
35
src/helpers/baseEmbeds/index.ts
Normal 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 });
|
||||
};
|
Loading…
Add table
Reference in a new issue