FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
dglazkov

dglazkov

discordBot

Public
Like
2
discordBot
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
3
History
Environment variables
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
7/6/2024
README.md

A simple Discord Bot scaffolding, a slight rev on the one in the valtown guide.

The discordBot function takes in an object where each key is a Discord command and the value is a function to handle the command. If the function returns a Promise, it will be handled as a deferred interaction with a followup message.

Usage:

Create val
import { discordBot } from "https://esm.town/v/dglazkov/discordBot"; const echo = async (data) => { await new Promise((r) => setTimeout(r, 5000)); return { type: 4, data: { content: data.data.options[0].value, }, }; }; export default discordBot({ ping: () => ({ type: 4, data: { content: `Pong! It is ${new Date()}`, }, }) echo, });
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.