(interaction)
| 9 | .setDescription('Get the current Unix timestamp'), |
| 10 | |
| 11 | async execute(interaction) { |
| 12 | await InteractionHelper.safeExecute( |
| 13 | interaction, |
| 14 | async () => { |
| 15 | const now = new Date(); |
| 16 | const unixTimestamp = Math.floor(now.getTime() / 1000); |
| 17 | |
| 18 | const embed = successEmbed( |
| 19 | '⏱️ Current Unix Timestamp', |
| 20 | `**Seconds since Unix Epoch:** \`${unixTimestamp}\`\n` + |
| 21 | `**Milliseconds since Unix Epoch:** \`${now.getTime()}\`\n\n` + |
| 22 | `**Human-readable (UTC):** ${now.toUTCString()}\n` + |
| 23 | `**ISO String:** ${now.toISOString()}` |
| 24 | ); |
| 25 | embed.setColor(getColor('success')); |
| 26 | |
| 27 | await InteractionHelper.safeEditReply(interaction, { |
| 28 | embeds: [embed], |
| 29 | }); |
| 30 | }, |
| 31 | 'Failed to get unix timestamp. Please try again.', |
| 32 | { |
| 33 | autoDefer: true, |
| 34 | deferOptions: { flags: MessageFlags.Ephemeral } |
| 35 | } |
| 36 | ); |
| 37 | }, |
| 38 | }; |
nothing calls this directly
no test coverage detected