1export async function getCurrentWeather(latitude = 0, longitude = 0) {
2 const pointsResponse = await fetch(`https://api.weather.gov/points/${latitude},${longitude}`),
3 { properties: { forecastHourly } } = await pointsResponse.json(),
1export async function handle() {
2 // Schedule work to do later
3 new Promise<void>(async (resolve) => {
2import { parse } from "npm:cookie";
3
4export default async function(req: Request): Promise<Response> {
5 const origin = req.headers.get("origin") ?? "*";
6 const { D = randomUUID() } = parse(req.headers.get("cookie") ?? "");
1// a very slow and sleepy function
2// pass it ?sleep=33 to make it sleep for that amount of sleep
3export default async function (req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const sleepQueryParam = url.searchParams.get('sleep');
1export default async function(req: Request): Promise<Response> {
2 console.log(req.url);
3 if (req.headers.get("x-fd-healthprobe") == "1") {
18}
19
20async function BlobPreset<Data>(key: string, initialData: Data) {
21 const db = new Low(new Blob<Data>(key), initialData);
22 await db.read();
1This val provides a way of readily having lots of different Slack bots that do different things and support different Slack workspaces without needing a bunch of Val Town accounts. If you only need a single bot on a single workspace, just go with the approach in the Val Town [docs](https://docs.val.town/integrations/slack/bot/).
2
3This bot is essentially the one described in the Val Town [docs](https://docs.val.town/integrations/slack/bot/), but without any of the details. Those are externalized by the SlackConfig and SlackFunction interfaces. It is just glue. In order to make it work, you will need the following additional glue:
4- a public HTTP val to handle requests like [this one](https://www.val.town/v/curtcox/Chatio)
5- a private val to supply any info missing from the public one like [this one](https://www.val.town/v/curtcox/_not_actually_private_so_that_you_can_see_it)
3import process from "node:process";
4
5export async function sailingNotifyCron({ lastRunAt }) {
6 const result = await sailingNotify("Fair Oaks, CA", 10);
7}
1import { getWeather } from "https://esm.town/v/chet/getWeather";
2import { email } from "https://esm.town/v/std/email";
3export async function sailingNotify(
4 where: string,
5 minWindMph = 1,
1import { blob } from "https://esm.town/v/std/blob";
2import { set } from "https://esm.town/v/std/set?v=11";
3export default async function(req: Request): Promise<Response> {
4 const searchParams = new URL(req.url).searchParams;
5 let value = searchParams.get("todo");
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",