Compare commits

...

3 Commits

3 changed files with 19 additions and 21 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "noticeuwuzu", "name": "noticeuwuzu",
"version": "v4.3@uwuzu1.5.4", "version": "v4.3.3@uwuzu1.5.4",
"description": "uwuzu Notice Bot", "description": "uwuzu Notice Bot",
"main": "dist/main.js", "main": "dist/main.js",
"scripts": { "scripts": {
+1 -1
View File
@@ -335,7 +335,7 @@ async function event(earthquakeInfo: any): Promise<void> {
// 地域情報更新の場合 // 地域情報更新の場合
else if (earthquakeInfo.code === 555) { else if (earthquakeInfo.code === 555) {
if (rateLimit === null) { if (rateLimit === null) {
rateLimit = subMinutes(new Date(), 15); rateLimit = subMinutes(new Date(), config.earthquake.rateLimit + 15);
} }
// 対象地域マッピング // 対象地域マッピング
+17 -19
View File
@@ -3,28 +3,26 @@ import { format } from "date-fns";
import type * as types from "types/types"; import type * as types from "types/types";
import config from "../config.js"; import config from "../config.js";
// 停止時間
// 時刻取得
const start = config.time.stopTimes.start;
const stop = config.time.stopTimes.stop;
// 現在の時間を取得
const nowHour = new Date().getHours();
// 停止時刻内かどうかの判定
let inRange: boolean = false;
if (start < stop) {
inRange = nowHour >= start && nowHour < stop;
} else {
inRange = nowHour >= start || nowHour < stop;
}
export default async function timeNotice() { export default async function timeNotice() {
console.log("----------------"); console.log("----------------");
// 停止時間
// 時刻取得
const start = config.time.stopTimes.start;
const stop = config.time.stopTimes.stop;
// 現在の時間を取得
const nowHour = new Date().getHours();
// 停止時刻内かどうかの判定
let inRange: boolean = false;
if (start < stop) {
inRange = nowHour >= start && nowHour < stop;
} else {
inRange = nowHour >= start || nowHour < stop;
}
if (inRange) { if (inRange) {
console.log("時報休止期間のため投稿されませんでした"); console.log("時報休止期間のため投稿されませんでした");
return; return;