mirror of
https://github.com/kou029w/daraz-san.git
synced 2025-01-18 16:08:06 +00:00
Asia/Tokyo対応
This commit is contained in:
parent
a5330609dc
commit
e8f5175aab
3 changed files with 21 additions and 6 deletions
|
@ -17,6 +17,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@slack/bolt": "^1.2.0",
|
"@slack/bolt": "^1.2.0",
|
||||||
"date-fns": "^2.0.1",
|
"date-fns": "^2.0.1",
|
||||||
|
"date-fns-tz": "^1.0.7",
|
||||||
"get-video-id": "^3.1.4",
|
"get-video-id": "^3.1.4",
|
||||||
"glob": "^7.1.4",
|
"glob": "^7.1.4",
|
||||||
"kuromoji": "^0.1.2",
|
"kuromoji": "^0.1.2",
|
||||||
|
|
|
@ -1,27 +1,36 @@
|
||||||
const subMinutes = require("date-fns/subMinutes");
|
const subMinutes = require("date-fns/subMinutes");
|
||||||
const roundToNearestMinutes = require("date-fns/roundToNearestMinutes");
|
const roundToNearestMinutes = require("date-fns/roundToNearestMinutes");
|
||||||
const format = require("date-fns/format");
|
const format = require("date-fns-tz/format");
|
||||||
|
const utcToZonedTime = require("date-fns-tz/utcToZonedTime");
|
||||||
const nyanco = require("./util/nyanco");
|
const nyanco = require("./util/nyanco");
|
||||||
|
|
||||||
|
const timeZone = "Asia/Tokyo";
|
||||||
const prefNumber = 34;
|
const prefNumber = 34;
|
||||||
const pageURL = `https://www.tenki.jp/radar/7/${prefNumber}/`;
|
const pageURL = `https://www.tenki.jp/radar/7/${prefNumber}/`;
|
||||||
const imgURL = target =>
|
const imgURL = target =>
|
||||||
[
|
[
|
||||||
"https://static.tenki.jp/static-images/radar/",
|
"https://static.tenki.jp/static-images/radar/",
|
||||||
format(target, "yyyy/MM/dd/HH/mm/ss"),
|
format(target, "yyyy/MM/dd/HH/mm/ss", { timeZone }),
|
||||||
`/pref-${prefNumber}-large.jpg`
|
`/pref-${prefNumber}-large.jpg`
|
||||||
].join("");
|
].join("");
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
/天気/,
|
/天気/,
|
||||||
async ({ say }) => {
|
async ({ say }) => {
|
||||||
const target = roundToNearestMinutes(subMinutes(new Date(), 5), {
|
const target = utcToZonedTime(
|
||||||
nearestTo: 5
|
roundToNearestMinutes(subMinutes(new Date(), 5), {
|
||||||
});
|
nearestTo: 5
|
||||||
|
}),
|
||||||
|
timeZone
|
||||||
|
);
|
||||||
|
|
||||||
say(
|
say(
|
||||||
[
|
[
|
||||||
`${nyanco()} < ${format(target, "HH時mm分の雨雲の様子にゃーん")}`,
|
`${nyanco()} < ${format(
|
||||||
|
target,
|
||||||
|
"HH時mm分の雨雲の様子にゃーん",
|
||||||
|
timeZone
|
||||||
|
)}`,
|
||||||
imgURL(target),
|
imgURL(target),
|
||||||
pageURL
|
pageURL
|
||||||
].join("\n")
|
].join("\n")
|
||||||
|
|
|
@ -228,6 +228,11 @@ cookie@0.4.0:
|
||||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
|
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
|
||||||
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
|
integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==
|
||||||
|
|
||||||
|
date-fns-tz@^1.0.7:
|
||||||
|
version "1.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-1.0.7.tgz#1c80f7592cca5da4fd2085132936dcc7fa9afecd"
|
||||||
|
integrity sha512-oNfi/3IxRfmysRIT+QJMbO/44Uj10nApAYJvlayTmNRFZG+JqdOJYXm1DWU65DNlG/ySbuQwpFkGIa3b2XFUVw==
|
||||||
|
|
||||||
date-fns@^2.0.1:
|
date-fns@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.1.tgz#c5f30e31d3294918e6b6a82753a4e719120e203d"
|
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.1.tgz#c5f30e31d3294918e6b6a82753a4e719120e203d"
|
||||||
|
|
Loading…
Add table
Reference in a new issue