diff --git a/src/commands/time.ts b/src/commands/time.ts index a9fa84f..c05b63d 100644 --- a/src/commands/time.ts +++ b/src/commands/time.ts @@ -2,6 +2,7 @@ import { CacheType, Interaction } from "discord.js"; import moment from "moment-timezone"; const CURRENT_TIME_IN_MILLIS = "CURRENT_TIME_IN_MILLIS"; +const MILLIS_TO_TIMESTAMP = "MILLIS_TO_TIMESTAMP"; export const timeCommand = { name: "time", @@ -14,8 +15,15 @@ export const timeCommand = { type: 3, choices: [ { name: "Current time in millis", value: CURRENT_TIME_IN_MILLIS }, + { name: "Millis to Timestamp", value: MILLIS_TO_TIMESTAMP }, ], }, + { + name: "value", + description: "The value to convert", + required: false, + type: 4, + }, ], execute: async (interaction: Interaction) => { @@ -32,6 +40,19 @@ export const timeCommand = { await interaction.reply(moment().valueOf().toString()); break; } + case MILLIS_TO_TIMESTAMP: { + const valueOption = options.get("value"); + if (!valueOption) { + await interaction.reply("⚠️ Value is required for this operation"); + return; + } + + const value = valueOption.value as number; + await interaction.reply( + moment(value).format("YYYY-MM-DD hh:mm:ss a") + ); + break; + } } } },