2026.4.0-beta.0 #12

Merged
last2014 merged 11 commits from develop into main 2026-05-03 05:28:47 +00:00
Showing only changes of commit 95aa0bdb45 - Show all commits
+18 -16
View File
@@ -142,32 +142,34 @@ const processMessage = async (message: any) => {
"Potential": "🚨この地震によって**一般的に**この規模では津波の可能性があると考えられています。",
}
let points: Record<string, any[]> = {};
const grouped: Record<string, { scale: number; prefs: Record<string, string[]> }> = {};
for (const point of message.points) {
const scaleMsg = scaleMessages[String(point.scale)];
if (!scaleMsg)
continue;
points[scaleMsg]?.push(point);
}
const grouped: Record<string, { scale: number; addrs: string[] }> = {};
for (const point of message.points) {
const { addr, scale } = point;
const { addr, scale, pref } = point;
const label = scaleMessages[String(scale)] ?? "不明";
if (!grouped[label]) {
grouped[label] = { scale, addrs: [] };
grouped[label] = { scale, prefs: {} };
}
grouped[label].addrs.push(addr);
if (!grouped[label].prefs[pref]) {
grouped[label].prefs[pref] = [];
}
grouped[label].prefs[pref].push(addr);
}
const pointsMsg = Object.entries(grouped)
.sort((a, b) => b[1].scale - a[1].scale)
.map(([label, { addrs }]) =>
`${label}${EOL}${addrs.join("・")}`)
.join(EOL.repeat(2)).trim();
.map(([label, { prefs }]) => {
const prefLines = Object.entries(prefs)
.map(([pref, addrs]) => `${pref}: ${addrs.join("・")}`)
.join(EOL);
return `${label}${EOL}${prefLines}`;
})
.join(EOL.repeat(2))
.trim();
await createUeuse({
text: i18next.t("earthquakeNotice", {