FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
jrmann100
jrmann100crone
Public
Like
crone
Home
Code
11
handlers
2
middleware
1
routes
1
scripts
2
util
5
.gitignore
.vtignore
AGENTS.md
README.md
deno.json
H
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
5
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v763
View latest version
README.md

Discord Timestamp Bot

A Discord bot that converts human-readable dates and times into Discord timestamp formats with autocomplete.

Setup Instructions

1. Environment Variables

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"

2. Generate 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.

3. Register Slash Commands

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.

4. Run the Bot

Start the bot server:

deno run --allow-net --allow-env main.ts

Usage

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).

Available Formats

  • 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)
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.