{ "path": "u/akiracraftwork/hourly_chime", "summary": "鳩時計機能", "description": "", "value": { "modules": [ { "id": "a", "value": { "lock": "{\n \"dependencies\": {}\n}\n//bun.lock\n", "type": "rawscript", "content": "export async function main(\n device: string = \"オフィスの右エコー\",\n prefix: string = \"現在時刻は\",\n suffix: string = \"です\"\n) {\n const now = new Date();\n const hhmm = new Intl.DateTimeFormat(\"ja-JP\", {\n timeZone: \"Asia/Tokyo\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n }).format(now); // 例: 09:30\n\n const [h, m] = hhmm.split(\":\");\n const text = `${prefix}${Number(h)}時${Number(m)}分${suffix}`;\n\n const res = await fetch(\"http://alexa_api:3500/speak\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ device, text }),\n });\n\n if (!res.ok) {\n const body = await res.text();\n throw new Error(`alexa-api error ${res.status}: ${body}`);\n }\n\n return { ok: true, device, text };\n}\n", "language": "bun", "input_transforms": { "device": { "type": "static", "value": "オフィスの右エコー" }, "prefix": { "type": "static", "value": "現在時刻は" }, "suffix": { "type": "static", "value": "です" } } } } ] }, "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": {}, "required": [], "type": "object" } }