mirror of
https://github.com/syuilo/ai.git
synced 2025-03-25 21:12:56 +00:00
インデント修正
This commit is contained in:
parent
a6ccecc155
commit
23391583df
2 changed files with 47 additions and 25 deletions
|
@ -48,7 +48,18 @@ export default class extends Module {
|
|||
public readonly name = "earthquake";
|
||||
private message: string = "";
|
||||
|
||||
private earthQuakeIndex: string[] = ["0未満", "0", "1", "2", "3", "4", "5弱", "5強", "6弱", "7"]
|
||||
private earthQuakeIndex: string[] = [
|
||||
"0未満",
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5弱",
|
||||
"5強",
|
||||
"6弱",
|
||||
"7",
|
||||
];
|
||||
|
||||
@autobind
|
||||
public install() {
|
||||
|
@ -81,34 +92,41 @@ export default class extends Module {
|
|||
max_index: rawDataJSON.max_index,
|
||||
intensity_list: rawDataJSON.intensity_list,
|
||||
};
|
||||
this.message = `地震かも?\n\n震度レポート\n${data.time.toLocaleString()}\n最大震度:${this.earthQuakeIndex[data.max_index + 1]}\n\n${
|
||||
data.intensity_list.map((intensity) =>
|
||||
`震度${this.earthQuakeIndex[intensity.index + 1]}: ${intensity.region_list.join(" ")}`
|
||||
).join("\n")
|
||||
}`;
|
||||
} if (rawDataJSON.type == 'eew' && false) { // これ使わなさそうだしとりあえず入らないようにした
|
||||
const data: 緊急地震速報 = {
|
||||
type: rawDataJSON.type,
|
||||
time: new Date(parseInt(rawDataJSON.time)),
|
||||
report: rawDataJSON.report,
|
||||
epicenter: rawDataJSON.epicenter,
|
||||
depth: rawDataJSON.depth,
|
||||
magnitude: rawDataJSON.magnitude,
|
||||
latitude: rawDataJSON.latitude,
|
||||
longitude: rawDataJSON.longitude,
|
||||
intensity: rawDataJSON.intensity,
|
||||
index: rawDataJSON.index,
|
||||
}
|
||||
this.message =
|
||||
`地震かも?\n\n震度レポート\n${data.time.toLocaleString()}\n最大震度:${
|
||||
this.earthQuakeIndex[data.max_index + 1]
|
||||
}\n\n${
|
||||
data.intensity_list.map((intensity) =>
|
||||
`震度${this.earthQuakeIndex[intensity.index + 1]}: ${
|
||||
intensity.region_list.join(" ")
|
||||
}`
|
||||
).join("\n")
|
||||
}`;
|
||||
}
|
||||
if (rawDataJSON.type == "eew" && false) { // これ使わなさそうだしとりあえず入らないようにした
|
||||
const data: 緊急地震速報 = {
|
||||
type: rawDataJSON.type,
|
||||
time: new Date(parseInt(rawDataJSON.time)),
|
||||
report: rawDataJSON.report,
|
||||
epicenter: rawDataJSON.epicenter,
|
||||
depth: rawDataJSON.depth,
|
||||
magnitude: rawDataJSON.magnitude,
|
||||
latitude: rawDataJSON.latitude,
|
||||
longitude: rawDataJSON.longitude,
|
||||
intensity: rawDataJSON.intensity,
|
||||
index: rawDataJSON.index,
|
||||
};
|
||||
|
||||
if (data.report == '1') {
|
||||
this.message = `**TEST TEST TEST TEST**\n地震かも?\n\n緊急地震速報\n${data.time.toLocaleString()}\n\n第${data.report}報\n震源地: ${data.epicenter}\n震源の深さ: ${data.depth}\n地震の規模(M): ${data.magnitude}\n緯度: ${data.latitude}\n経度: ${data.longitude}\n予想される最大震度(?): ${data.intensity}\n`;
|
||||
}
|
||||
}
|
||||
console.log(rawDataJSON); // デバッグ用
|
||||
if (data.report == "1") {
|
||||
this.message =
|
||||
`**TEST TEST TEST TEST**\n地震かも?\n\n緊急地震速報\n${data.time.toLocaleString()}\n\n第${data.report}報\n震源地: ${data.epicenter}\n震源の深さ: ${data.depth}\n地震の規模(M): ${data.magnitude}\n緯度: ${data.latitude}\n経度: ${data.longitude}\n予想される最大震度(?): ${data.intensity}\n`;
|
||||
}
|
||||
}
|
||||
console.log(rawDataJSON); // デバッグ用
|
||||
this.returnResponse(res, "ok");
|
||||
if (this.message) {
|
||||
this.ai.post({
|
||||
cw: "試験運用中!!!!!",
|
||||
cw: "試験運用中!!!!!",
|
||||
visibility: "home",
|
||||
text: this.message,
|
||||
});
|
||||
|
|
4
src/modules/earthquake/テスト用生データ.txt
Normal file
4
src/modules/earthquake/テスト用生データ.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
# テスト用生データ
|
||||
{"type":"pga_alert","time":"1649085285968","max_pga":-0.531,"new":true,"estimated_intensity":0,"region_list":["\u8328\u57ce"]}
|
||||
{"type":"intensity_report","time":"1649085285968","max_index":-1,"intensity_list":[{"intensity":"0\u672a\u6e80","index":-1,"region_list":["\u8328\u57ce"]}]}
|
||||
{"type": "eew","report": "1","epicenter": "伊予灘","depth": "60km","magnitude": 3.5,"latitude": 33.8,"longitude": 132.1,"intensity": "2","index": 2}
|
Loading…
Reference in a new issue