22});
23
24export default app.fetch;
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
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,
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import axios from "npm:axios";
3import formData from "npm:form-data";
16 reply_markup?: any[];
17}) =>
18 fetchJSON(
19 `https://api.telegram.org/bot${botToken}/sendMessage`,
20 {
34
35 try {
36 // Replace axios with Deno's fetch API, adapted for your setup
37 const response = await fetch(url, {
38 method: "POST",
39 body: data, // FormData instance directly as the body
1This is an RSS parser val, similar to @stevekrouse.fetchRSS, but uses an NPM parsing library
2so it can support multiple RSS feed types easily.
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// This supports more RSS types than @stevekrouse.fetchRSS
4export async function fetchRss(url: string, lastRunDate?: string | number) {
5 let Parser = await import("npm:rss-parser");
6 let parser = new Parser.default();
7 let response = await fetch(url);
8 let data = await response.text();
9 let { items } = await parser.parseString(data);
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
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";
4import { DateTime } from "npm:luxon";
127
128 try {
129 const { code } = await fetchJSON(`${API_URL}/v1/alias/${vtUser}/${valName}`, {
130 headers: { "Authorization": `Bearer ${Deno.env.get("valtown")}` },
131 });
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function latestBlogContent() {
4 return (
5 await fetch(
6 "https://datasette.simonwillison.net/simonwillisonblog.json?_shape=array&sql=select+%27entry%27+as+type%2C+title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fe%2F%27+%7C%7C+id+as+url+from+blog_entry%0D%0Aunion+all%0D%0Aselect+%27blogmark%27+as+type%2C+link_title%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fb%2F%27+%7C%7C+id+from+blog_blogmark%0D%0Aunion+all%0D%0Aselect+%27quotation%27+as+type%2C+source%2C+created%2C+%27https%3A%2F%2Fsimonwillison.net%2Fq%2F%27+%7C%7C+id+from+blog_quotation%0D%0Aorder+by+created+desc"
7 )
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function openaiUploadFile({ key, data, filename = "data.json", purpose = "assistants" }: {
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: {