1export default async function(req: Request): Promise<Response> {
2 logTimeLater();
3 return Response.json({ time: new Date() });
4}
5
6async function logTimeLater() {
7 await new Promise((resolve) => {
8 setTimeout(() => {
2import { email } from "https://esm.town/v/std/email?v=11";
3
4export async function sendNewsletterReminder(interval: Interval) {
5 // await email({
6 // subject: `Reminder to prepare newsletter #${newsletters.length + 1}`,
3Cousin Val to [@petermillspaugh/emailSubscription](https://www.val.town/v/petermillspaugh/emailSubscription) for emailing yourself a reminder to send your next newsletter.
4
5Since this Val is public, anyone can run it. I've commented out the function body that actually emails me to prevent anyone from spamming me, but you can fork this as a private Val to set a cron reminder.
6
7Migrated from folder: EmailSubscriptions/sendNewsletterReminder
7import { Hono } from "npm:hono";
8
9export async function emailSubscription(req: Request) {
10 const app = new Hono();
11
3let cache: [string, AuthTokens] | undefined;
4
5export function moduleFetch(input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response> {
6 const req = new Request(input, init);
7 let authTokens = Deno.env.get("DENO_AUTH_TOKENS");
2import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
3
4export function getJanuary2024Newsletter() {
5 const subject = "#1 — January 2024";
6 const webUrl = "https://petemillspaugh.com/january-2024";
169}
170
171async function insertIntoNewslettersTable() {
172 const { subject, webUrl, targetSendDate } = getJanuary2024Newsletter();
173
14];
15
16export async function dailyEmailSubscriptionStats(interval: Interval) {
17 const { rows: newSubs } = await sqlite.execute(`
18 SELECT name, email
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
2
3export async function createEmailLogsTable() {
4 await sqlite.execute(
5 `
1import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
2
3export async function createNewslettersTable() {
4 await sqlite.execute(
5 `
2import { getCurrentWeather } from "https://esm.town/v/cosmo/get_current_weather";
3
4export async function getWeatherMessage(apiKey, latitude, longitude) {
5 const currentWeather = await getCurrentWeather(latitude, longitude),
6 { icon } = currentWeather,
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": "*",