9const LOCK_TIMEOUT = 15 * 60 * 1000;
10
11// Main function that runs as a scheduled val
12export default async function() {
13 console.log("🕒 Map Vote Cron Job started");
14
109}
110
111// Utility function to clear the lock manually if needed
112export async function clearLock() {
113 try {
114 await blob.delete("is_creating_map_vote");
57const FNG_API_URL = "https://api.alternative.me/fng/?limit=1";
58
59async function fetchFromApi<T>(url: string, isCoinGecko: boolean = true): Promise<T | null> {
60 const headers: HeadersInit = {};
61 if (isCoinGecko && COINGECKO_API_KEY) {
78}
79
80export default async function(req: Request): Promise<Response> {
81 // Set CORS headers to allow requests from any origin (or restrict to your frontend's domain)
82 // For development, '*' is fine. For production, specify your frontend's origin.
27}
28// Get current configuration from hardcoded values
29export function getCurrentConfig() {
30 try {
31 const config = {
42
43// Get completed vote bookend embed data
44export function getCompletedVoteBookendEmbedData(): CompletedVoteCreationBookendEmbedData {
45 return {
46 topBookend: {
23}
24
25export function getHellLetLooseMapData(): HellLetLooseMapData {
26 return {
27 Maps: [
12
13// Get initial embed data
14export function getInitialEmbedData(): InitialVoteCreationEmbedData {
15 return {
16 InitialEmbedTitle: "Loading . . .",
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function translateToEnglishWithOpenAI(text: string) {
4 const openai = new OpenAI();
5 const completion = await openai.chat.completions.create({
1// Get alphabet image URLs
2export function getAlphabetImageUrls(): Record<string, string> {
3 return {
4 "A": "https://i.imgur.com/POhK1wg.png",
4import { load } from "npm:cheerio";
5
6async function mastodonWeatherMap() {
7 const html = await fetchText("https://www.bankier.pl//gielda/notowania/indeksy-gpw"); // Przykład linku do strony z ETF-ami
8 const $ = load(html);
A helper function to build a file's email
Simple functional CSS library for Val Town
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.