crone
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v764View latest version
A Discord bot that converts human-readable dates and times into Discord timestamp formats with autocomplete.
This application requires the following environment variables:
# Required Discord API credentials CLIENT_ID="your_discord_client_id" CLIENT_SECRET="your_discord_client_secret" APPLICATION_ID="your_discord_application_id" APPLICATION_PUBLIC_KEY="your_discord_public_key" # Token for slash command registration (will be generated) COMMAND_ACCESS_TOKEN="your_command_access_token"
Before registering commands, you need to generate a Discord API access token:
deno run --allow-net --allow-env generateSetupToken.ts
This will output a token which you should set as the COMMAND_ACCESS_TOKEN
environment variable.
After setting up your environment variables including the generated token:
deno run --allow-net --allow-env scripts/setup.ts
This will register the /timestamp
slash command with Discord.
Start the bot server:
deno run --allow-net --allow-env main.ts
The bot provides a /timestamp
slash command with the following options:
at
: (Required) A human-readable time string like "tomorrow 2pm" or "next Friday at noon"format
: (Optional) The Discord timestamp format to use, with autocomplete
If no format is selected, all available format options will be displayed.
The command is available in:
- Servers (guilds)
- Direct messages with the bot
- Group DMs and private channels
All responses are ephemeral (only visible to the user who invoked the command).
t
: Short Time (1:23 PM)T
: Long Time (1:23:45 PM)d
: Short Date (09/11/2025)D
: Long Date (September 11, 2025)f
: Short Date/Time (September 11, 2025 1:23 PM)F
: Long Date/Time (Thursday, September 11, 2025 1:23 PM)R
: Relative (in 2 days)