3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,
113. 🤣🤣🤣🤣
12
13## API
14
15This val uses the [icanhazdadjoke API](https://icanhazdadjoke.com/api). You can find [more docs here](https://github.com/15Dkatz/official_joke_api), such as how to [filter by type](https://github.com/15Dkatz/official_joke_api?tab=readme-ov-file#grab-jokes-by-type).
17}) =>
18 fetchJSON(
19 `https://api.telegram.org/bot${botToken}/sendMessage`,
20 {
21 method: "POST",
25
26export async function telegramSendAudioMessage(chatId: string, audioData: Uint8Array, botToken: string): Promise<void> {
27 const url = `https://api.telegram.org/bot${botToken}/sendAudio`;
28
29 // Assuming FormData is available or correctly polyfilled
34
35 try {
36 // Replace axios with Deno's fetch API, adapted for your setup
37 const response = await fetch(url, {
38 method: "POST",
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();
1import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=42";
3import { Octokit } from "npm:@octokit/rest";
127
128 try {
129 const { code } = await fetchJSON(`${API_URL}/v1/alias/${vtUser}/${valName}`, {
130 headers: { "Authorization": `Bearer ${Deno.env.get("valtown")}` },
131 });
17 formData.append("purpose", purpose);
18 formData.append("file", file, filename);
19 let result = await fetch("https://api.openai.com/v1/files", {
20 method: "POST",
21 headers: {
1# [Val Town Search](https://val-town-search.pomdtr.me)
2
3Search for vals using the Github API.
4
5Either use the provided UI, or the query param:
1import { insecureFetch } from "https://esm.town/v/stevekrouse/insecureFetch";
2
3const url = "https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20";
4const data = await insecureFetch(url);
5const text = await data.text();
1/** @jsxImportSource npm:hono/jsx **/
2
3import { api } from "https://esm.town/v/pomdtr/api";
4import { honoMiddleware } from "https://esm.town/v/pomdtr/codeOnValTown";
5import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
1import { api } from "https://esm.town/v/pomdtr/api";
2
3type ValRef = {
23export async function searchReferences(val: ValRef) {
24 const esmUrl = `https://esm.town/v/${val.author}/${val.name}`;
25 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent(esmUrl)}`, {
26 authenticated: true,
27 paginate: true,