diff options
| author | Fuwn <[email protected]> | 2025-10-03 12:38:40 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-10-03 12:38:40 -0700 |
| commit | 6ce3edd9c2a046925c6e7a524c017143248a3814 (patch) | |
| tree | cff6ab17aea2b9588fa7142168db80c7f5754de1 /packages/interactions/discord | |
| parent | fix(gateway:moderationAgent): Update model structure and handling guidelines (diff) | |
| download | umabotdiscord-6ce3edd9c2a046925c6e7a524c017143248a3814.tar.xz umabotdiscord-6ce3edd9c2a046925c6e7a524c017143248a3814.zip | |
feat(nsfw-apply): Add discord and server join date fields
Diffstat (limited to 'packages/interactions/discord')
| -rw-r--r-- | packages/interactions/discord/embeds.ts | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/packages/interactions/discord/embeds.ts b/packages/interactions/discord/embeds.ts index 38dfc00..bbae714 100644 --- a/packages/interactions/discord/embeds.ts +++ b/packages/interactions/discord/embeds.ts @@ -185,23 +185,41 @@ export const createNSFWApplicationEmbed = ( applicant: { username: string; id: string; avatar?: string }, timestamp: number, isDM: boolean = true, + discordJoinDate?: string, + serverJoinDate?: string, ): DiscordEmbed => { + const fields = [ + { + name: "Applicant", + value: `<@${applicant.id}>`, + inline: true, + }, + { + name: "Timestamp", + value: `<t:${Math.floor(timestamp / 1000)}:F>`, + inline: true, + }, + ]; + + if (serverJoinDate) + fields.push({ + name: "Server Join Date", + value: `<t:${Math.floor(new Date(serverJoinDate).getTime() / 1000)}:F>`, + inline: true, + }); + + if (discordJoinDate) + fields.push({ + name: "Discord Join Date", + value: `<t:${Math.floor(new Date(discordJoinDate).getTime() / 1000)}:F>`, + inline: true, + }); + return { title: "🔞 NSFW Access Application", description: applicationContent, color: 0xff69b4, - fields: [ - { - name: "Applicant", - value: `${applicant.username} (${applicant.id})`, - inline: true, - }, - { - name: "Timestamp", - value: `<t:${Math.floor(timestamp / 1000)}:F>`, - inline: true, - }, - ], + fields, thumbnail: applicant.avatar ? { url: `https://cdn.discordapp.com/avatars/${applicant.id}/${applicant.avatar}${applicant.avatar.startsWith("a_") ? ".gif" : ".png"}?size=256`, |