Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=api&page=213&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 13013 results for "api"(972ms)

discord-botREADME.md12 matches

@boucher•Updated 2 weeks ago
13
14- **Database Layer**: Uses Val.town's built-in SQLite database
15- **AI Integration**: Leverages Anthropic's Claude API for analysis
16- **Discord Integration**:
17 - Bot token for fetching messages
18 - Slash commands for user interactions
19 - Webhook endpoint for Discord interactions
20- **API Endpoints**: Various endpoints for manual operations and automation
21
22## Setup
31- `DISCORD_USER_ID`: Your Discord user ID
32- `SPOUSE_USER_ID`: Your partner's Discord user ID
33- `ANTHROPIC_API_KEY`: Your Anthropic API key
34
35### Discord Bot Setup
54## Usage
55
56### API Endpoints
57
58- `GET /health`: Check if the service is running
59- `POST /api/interactions`: Discord interactions endpoint
60- `POST /api/fetch-dms`: Manually trigger DM fetching
61- `POST /api/process-links`: Manually trigger link processing
62- `POST /api/query`: Process a query about your messages
63- `POST /api/commands/search`: Endpoint for search commands
64- `POST /api/register-commands`: Register Discord slash commands
65- `GET /api/cron/fetch-dms`: Cron endpoint for fetching DMs
66- `GET /api/cron/process-links`: Cron endpoint for processing links
67
68### Discord Commands

discord-bottypes.ts1 match

@boucher•Updated 2 weeks ago
112}
113
114// Claude API types
115export interface ClaudeOptions {
116 model?: string;

discord-botindex.ts9 matches

@boucher•Updated 2 weeks ago
69app.get("/shared/*", c => serveFile(c.req.path, import.meta.url));
70
71// API endpoints
72
73// Health check endpoint
81
82// Discord interactions endpoint
83app.post("/api/interactions", async c => {
84 return await handleDiscordInteractionRequest(c.req.raw);
85});
86
87// Manual trigger for fetching DMs
88app.post("/api/fetch-dms", async c => {
89 try {
90 log("Manually triggering DM fetch...", "info");
106
107// Manual trigger for processing links
108app.post("/api/process-links", async c => {
109 try {
110 log("Manually triggering link processing...", "info");
124
125// Query endpoint
126app.post("/api/query", async c => {
127 try {
128 const body = await c.req.json();
151
152// Discord command endpoints
153app.post("/api/commands/search", async c => {
154 try {
155 const body = await c.req.json();
214
215// Register commands endpoint
216app.post("/api/register-commands", async c => {
217 try {
218 const applicationId = getEnv("DISCORD_CLIENT_ID");
297
298// Expose cron endpoints via HTTP as well
299app.get("/api/cron/fetch-dms", async c => {
300 const result = await cronFetchDMs();
301 return c.json(result, result.success ? 200 : 500);
302});
303
304app.get("/api/cron/process-links", async c => {
305 const result = await cronProcessLinks();
306 return c.json(result, result.success ? 200 : 500);

discord-botdiscord-commands.ts2 matches

@boucher•Updated 2 weeks ago
47/**
48 * Helper function to send command definitions to Discord
49 * This would typically be called during setup using the Discord API
50 */
51export async function registerCommands(applicationId: string, token: string) {
52 const endpoint = `https://discord.com/api/v10/applications/${applicationId}/commands`;
53
54 try {

discord-botanthropic-service.ts4 matches

@boucher•Updated 2 weeks ago
12export function initializeAnthropic() {
13 if (!anthropic) {
14 const apiKey = getEnv("ANTHROPIC_API_KEY");
15
16 if (!apiKey) {
17 throw new Error("ANTHROPIC_API_KEY environment variable is required");
18 }
19
20 anthropic = new Anthropic({
21 apiKey,
22 });
23

discord-botdiscord-client.ts6 matches

@boucher•Updated 2 weeks ago
2import { saveDMMessages } from "./database.ts";
3
4// Discord API endpoints
5const API_BASE = "https://discord.com/api/v10";
6
7/**
8 * Handle fetching DMs between users using Discord's API
9 */
10export class DiscordClient {
53 async getDMChannel(userId: string) {
54 try {
55 const response = await fetch(`${API_BASE}/users/@me/channels`, {
56 method: "POST",
57 headers: {
88 let keepFetching = true;
89
90 // Fetch messages in batches of 100 (Discord API limit)
91 while (keepFetching) {
92 let url = `${API_BASE}/channels/${channelId}/messages?limit=100`;
93 if (lastId) {
94 url += `&before=${lastId}`;

discord-botval-town-deploy.js3 matches

@boucher•Updated 2 weeks ago
26 },
27 {
28 file: 'api-server.js',
29 name: 'discordDMBotAPI',
30 isPublic: true,
31 description: 'HTTP API for Discord DM bot'
32 }
33];

discord-botApp.tsx5 matches

@boucher•Updated 2 weeks ago
111 <tbody className="bg-white divide-y divide-gray-200">
112 <tr>
113 <td className="px-6 py-4 whitespace-nowrap font-mono text-sm">/api/interactions</td>
114 <td className="px-6 py-4 whitespace-nowrap text-sm">POST</td>
115 <td className="px-6 py-4 text-sm">Discord interactions endpoint</td>
116 </tr>
117 <tr>
118 <td className="px-6 py-4 whitespace-nowrap font-mono text-sm">/api/fetch-dms</td>
119 <td className="px-6 py-4 whitespace-nowrap text-sm">POST</td>
120 <td className="px-6 py-4 text-sm">Manually trigger DM fetching</td>
121 </tr>
122 <tr>
123 <td className="px-6 py-4 whitespace-nowrap font-mono text-sm">/api/process-links</td>
124 <td className="px-6 py-4 whitespace-nowrap text-sm">POST</td>
125 <td className="px-6 py-4 text-sm">Manually process links</td>
126 </tr>
127 <tr>
128 <td className="px-6 py-4 whitespace-nowrap font-mono text-sm">/api/query</td>
129 <td className="px-6 py-4 whitespace-nowrap text-sm">POST</td>
130 <td className="px-6 py-4 text-sm">Query your conversation data</td>
131 </tr>
132 <tr>
133 <td className="px-6 py-4 whitespace-nowrap font-mono text-sm">/api/register-commands</td>
134 <td className="px-6 py-4 whitespace-nowrap text-sm">POST</td>
135 <td className="px-6 py-4 text-sm">Register Discord slash commands</td>

discord-botDISCORD_BOT_SETUP.md6 matches

@boucher•Updated 2 weeks ago
57 ```
58
59## 7. Get OpenAI API Key
60
611. Go to [OpenAI's website](https://platform.openai.com/)
622. Sign up or log in
633. Navigate to the API keys section
644. Create a new API key
655. Copy the key
666. Add it to your `.env` file:
67 ```
68 OPENAI_API_KEY=your_openai_api_key_here
69 ```
70
153## Next Steps
154
1551. Customize the bot's responses by editing the API endpoints in `api-server.js`
1562. Add more categories for link classification in `database.js`
1573. Enhance the AI queries by modifying prompts in `query-service.js`
1584. Create a web interface that connects to your API endpoints

vt-discordindex.ts2 matches

@boucher•Updated 2 weeks ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 2 days ago
snartapi
mux
Your friendly, neighborhood video API.