Added a embed pre-builder to make all the embeds consistent.

This commit is contained in:
Nix Krystik
2026-05-29 08:52:53 +08:00
parent a4299318b0
commit 00da10da0c
3 changed files with 108 additions and 59 deletions
+31
View File
@@ -0,0 +1,31 @@
import { APIEmbed, Client } from 'discord.js';
type EmbedSeverity =
| 'default'
| 'info'
| 'warning'
| 'error'
| 'success'
export function CreateDefaultEmbed(context: Client): APIEmbed {
if (!context.user) return {};
return {
footer: {
icon_url: context.user.avatarURL()!,
text: context.user.username
},
timestamp: new Date().toISOString()
}
}
export function SetSeverity(severity: EmbedSeverity): APIEmbed {
switch (severity) {
case 'default': return { color: 0x014995 }
case 'info': return { color: 0x5865F2 }
case 'warning': return { color: 0xFEE75C }
case 'error': return { color: 0xED4245 }
case 'success': return { color: 0x57F287 }
}
}
+30 -29
View File
@@ -1,29 +1,30 @@
export * from './alt-utils';
export * from './array-utils';
export * from './audit-log-utils';
export * from './ban-events';
export * from './ban-utils';
export * from './channel-utils';
export * from './commands';
export * from './debug-utils';
export * from './discord-user-utils';
export * from './e621-utils';
export * from './event-log-utils';
export * from './file-utils';
export * from './github-user-utils';
export * from './interaction-utils';
export * from './message-matcher-regex';
export * from './message-utils';
export * from './modal-utils';
export * from './ms-to-human';
export * from './name-sync';
export * from './note-utils';
export * from './oauth2';
export * from './private-help-utils';
export * from './record-utils';
export * from './refresh-commands';
export * from './string-utils';
export * from './ticket-events';
export * from './ticket-utils';
export * from './wait';
export * from './whois';
export * from './alt-utils';
export * from './array-utils';
export * from './audit-log-utils';
export * from './ban-events';
export * from './ban-utils';
export * from './channel-utils';
export * from './commands';
export * from './debug-utils';
export * from './discord-user-utils';
export * from './embed-utils';
export * from './e621-utils';
export * from './event-log-utils';
export * from './file-utils';
export * from './github-user-utils';
export * from './interaction-utils';
export * from './message-matcher-regex';
export * from './message-utils';
export * from './modal-utils';
export * from './ms-to-human';
export * from './name-sync';
export * from './note-utils';
export * from './oauth2';
export * from './private-help-utils';
export * from './record-utils';
export * from './refresh-commands';
export * from './string-utils';
export * from './ticket-events';
export * from './ticket-utils';
export * from './wait';
export * from './whois';