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 }
}
}