Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers
at main 25 lines 705 B view raw
1import { drizzle } from "drizzle-orm/d1"; 2import { ExecutionContext } from "hono"; 3import { Bindings } from "../types"; 4 5export class ScheduledContext { 6 executionCtx: ExecutionContext; 7 env: Bindings; 8 // used for parameters wrappings such as "isAdmin" or "session" 9 // as a proxy for Context 10 #map: Map<string, any>; 11 constructor(env: Bindings, executionCtx: ExecutionContext) { 12 this.#map = new Map<string, any>(); 13 this.env = env; 14 this.executionCtx = executionCtx; 15 this.set("db", drizzle(env.DB)); 16 } 17 get(name: string) { 18 if (this.#map.has(name)) 19 return this.#map.get(name); 20 return null; 21 } 22 set(name: string, value: any) { 23 this.#map.set(name, value); 24 } 25};