13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 3. Notification
3Speech-to-text and chapter summaries powered by [Substrate](https://substrate.run)
4
5🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
6
7Migrated from folder: Archive/subaudio
1import { inTheBackground } from "https://esm.town/v/neverstew/inTheBackground";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=45";
26 headers["Authorization"] = `Bearer ${token}`;
27 }
28 const { id } = await fetchJSON(`${API_URL}/v1/alias/${userHandle}/${valName}`, { headers });
29
30 const table_name = "cron_evals";
1/** @jsxImportSource npm:hono/jsx */
2
3import { api } from "https://esm.town/v/pomdtr/api";
4import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
5import { Island } from "https://esm.town/v/pomdtr/hono_island";
17const router = new Hono();
18
19const me = await api("/v1/me", { authenticated: true });
20const author = me.username;
21
57});
58
59router.post("/api/refresh", async () => {
60 const tests = await loadTests();
61
65async function loadTests(): Promise<TestType[]> {
66 const query = `https://esm.town/v/${author}/test_explorer`;
67 const { data: vals } = await api(`/v1/search/vals?query=${query}`, { authenticated: true });
68 const tests = {};
69 for (const val of vals) {
103}
104
105router.post("/api/run", async (c) => {
106 const body = await c.req.json();
107 try {
1/** @jsxImportSource npm:hono/jsx */
2
3import { api } from "https://esm.town/v/pomdtr/api";
4import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
5import { Island } from "https://esm.town/v/pomdtr/hono_island";
56});
57
58router.post("/api/refresh", async () => {
59 const tests = await loadTests();
60
64async function loadTests(): Promise<TestType[]> {
65 const query = `https://esm.town/v/${author}/test_explorer`;
66 const { data: vals } = await api(`/v1/search/vals?query=${query}`, { authenticated: true });
67 const tests = {};
68 for (const val of vals) {
102}
103
104router.post("/api/run", async (c) => {
105 const body = await c.req.json();
106 try {
33
34In order to define a test, the user need to import the Test class from `https://val.town/v/<account>/Test`.
35So we can use the api to search for vals containing the `https://val.town/v/<account>/Test` string to locate the vals containing tests.
36
37Next, we need to extract the tests from the val exports. We use `exported instanceof Test` to filter them (at some point we will probably use static analysis for this).
1# Val Town REST API TypeScript SDK Demos
2
3This val demonstrates basic usage of the the Val Town JS/TS SDK.
5You can fork this val to your account to quickly try it out.
6
7Authentication is automatically set by the `VAL_TOWN_API_KEY` environment
8variable, which is automatically set within Val Town. You can control the
9API scopes of that key in your val's settings page.
10
11* [Learn more](https://docs.val.town/sdk/)
12* [Reference docs](https://github.com/val-town/sdk/blob/main/api.md)
13
14Migrated from folder: Archive/demoSDK
1export default async function(req: Request): Promise<Response> {
2 const response = await fetch("http://worldtimeapi.org/api/timezone/America/New_York")
3 const timeData = await response.json()
4
3import { renderToString } from "npm:react-dom/server";
4
5// This uses by personal API key, you'll need to provide your own if
6// you fork this. We'll be adding support to the std/openai lib soon!
7const openai = new OpenAI();
10</p>
11
12**⚠️ Note: Requires your own OpenAI API key to get this to run in a fork**
13
14Migrated from folder: Archive/chatGPT