27 lines
594 B
TypeScript
27 lines
594 B
TypeScript
import { format } from "date-fns";
|
|
|
|
import type * as types from "types/types";
|
|
|
|
import config from "../config.js";
|
|
|
|
export default async function timeNotice() {
|
|
// 現在時刻を取得
|
|
const now = format(new Date(), "HH:mm");
|
|
|
|
// 投稿
|
|
const resUeuse = await fetch(
|
|
`https://${config.uwuzuServer}/api/ueuse/create`,
|
|
{
|
|
method: "POST",
|
|
body: JSON.stringify({
|
|
token: config.apiToken,
|
|
text: `${now}になりました`,
|
|
}),
|
|
},
|
|
);
|
|
|
|
const ueuseData: types.ueuseCreateApi = await resUeuse.json();
|
|
|
|
console.log(JSON.stringify(ueuseData));
|
|
}
|