Feat: 天気予報の分割数を自動的に計算する機能 / Fix: 震度0の地震情報に対応していない問題 / Feat: 最大震度の要求を設定できる機能 / Feat: 最大震度が不明な場合に投稿するかどうかを設定できる機能
This commit is contained in:
+13
-4
@@ -7,12 +7,21 @@ const schema = z.object({
|
||||
command: z.object({
|
||||
interval: z.number().int().positive(),
|
||||
}),
|
||||
weather: z.object({
|
||||
splits: z.number().int().positive(),
|
||||
}),
|
||||
earthquake: z.object({
|
||||
requireMaxScale: z.union([
|
||||
z.literal(10),
|
||||
z.literal(20),
|
||||
z.literal(30),
|
||||
z.literal(40),
|
||||
z.literal(45),
|
||||
z.literal(50),
|
||||
z.literal(55),
|
||||
z.literal(60),
|
||||
z.literal(70),
|
||||
]),
|
||||
canUnknownMaxScale: z.boolean(),
|
||||
useHistoryData: z.boolean(),
|
||||
}).optional(),
|
||||
}),
|
||||
uwuzu: z.object({
|
||||
token: z.string().length(64),
|
||||
origin: z.string().refine(data => {
|
||||
|
||||
+19
-7
@@ -14,6 +14,7 @@ class MemoryClass {
|
||||
lastReadMention: "",
|
||||
lastReadReply: "",
|
||||
userid: "",
|
||||
max_length: 0,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -32,15 +33,26 @@ class MemoryClass {
|
||||
|
||||
const Memory = new MemoryClass();
|
||||
|
||||
export const initUserID = async () => {
|
||||
const response = await client.request("me/");
|
||||
export const initData = async () => {
|
||||
await Promise.all([
|
||||
(async () => {
|
||||
const response = await client.request("me/");
|
||||
|
||||
if (!response.success)
|
||||
throw new Error("meの取得に失敗しました");
|
||||
if (!response.success)
|
||||
throw new Error("meの取得に失敗しました");
|
||||
|
||||
const mem = Memory.memory;
|
||||
mem.userid = response.userid;
|
||||
Memory.memory = mem;
|
||||
const mem = Memory.memory;
|
||||
mem.userid = response.userid;
|
||||
Memory.memory = mem;
|
||||
})(),
|
||||
(async () => {
|
||||
const response = await client.request("serverinfo-api");
|
||||
|
||||
const mem = Memory.memory;
|
||||
mem.max_length = response.server_info.max_ueuse_length;
|
||||
Memory.memory = mem;
|
||||
})(),
|
||||
]);
|
||||
}
|
||||
|
||||
export default Memory;
|
||||
Reference in New Issue
Block a user