Auto-sync: 2026-03-03 05:00:01
This commit is contained in:
5
workflows/u/akiracraftwork/hourly_chime__flow/a.lock
Normal file
5
workflows/u/akiracraftwork/hourly_chime__flow/a.lock
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {}
|
||||
}
|
||||
//bun.lock
|
||||
<empty>
|
||||
29
workflows/u/akiracraftwork/hourly_chime__flow/a.ts
Normal file
29
workflows/u/akiracraftwork/hourly_chime__flow/a.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export async function main(
|
||||
device: string = "オフィスの右エコー",
|
||||
prefix: string = "現在時刻は",
|
||||
suffix: string = "です"
|
||||
) {
|
||||
const now = new Date();
|
||||
const hhmm = new Intl.DateTimeFormat("ja-JP", {
|
||||
timeZone: "Asia/Tokyo",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
}).format(now); // 例: 09:30
|
||||
|
||||
const [h, m] = hhmm.split(":");
|
||||
const text = `${prefix}${Number(h)}時${Number(m)}分${suffix}`;
|
||||
|
||||
const res = await fetch("http://alexa_api:3500/speak", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ device, text }),
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const body = await res.text();
|
||||
throw new Error(`alexa-api error ${res.status}: ${body}`);
|
||||
}
|
||||
|
||||
return { ok: true, device, text };
|
||||
}
|
||||
25
workflows/u/akiracraftwork/hourly_chime__flow/flow.yaml
Normal file
25
workflows/u/akiracraftwork/hourly_chime__flow/flow.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
summary: Hourly Chime
|
||||
description: ''
|
||||
value:
|
||||
modules:
|
||||
- id: a
|
||||
value:
|
||||
type: rawscript
|
||||
content: '!inline a.ts'
|
||||
input_transforms:
|
||||
device:
|
||||
type: static
|
||||
value: オフィスの右エコー
|
||||
prefix:
|
||||
type: static
|
||||
value: 現在時刻は
|
||||
suffix:
|
||||
type: static
|
||||
value: です
|
||||
lock: '!inline a.lock'
|
||||
language: bun
|
||||
schema:
|
||||
$schema: 'https://json-schema.org/draft/2020-12/schema'
|
||||
type: object
|
||||
properties: {}
|
||||
required: []
|
||||
Reference in New Issue
Block a user