地名ずつ返信
This commit is contained in:
parent
c4d2990118
commit
6c17683cc2
|
@ -5,7 +5,7 @@ import type * as types from "../types";
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
export default async function weatherNotice() {
|
export default async function weatherNotice() {
|
||||||
/*// 仮投稿
|
// 仮投稿
|
||||||
const resUeuse = await fetch(
|
const resUeuse = await fetch(
|
||||||
`https://${process.env.SERVER}/api/ueuse/create`,
|
`https://${process.env.SERVER}/api/ueuse/create`,
|
||||||
{
|
{
|
||||||
|
@ -22,12 +22,9 @@ export default async function weatherNotice() {
|
||||||
|
|
||||||
const ueuseData: types.ueuseCreateApi = await resUeuse.json();
|
const ueuseData: types.ueuseCreateApi = await resUeuse.json();
|
||||||
|
|
||||||
console.log(JSON.stringify(ueuseData));*/
|
console.log(JSON.stringify(ueuseData));
|
||||||
|
|
||||||
|
for (let i = 0; i < cityList.length; i++) {setTimeout(async () => {
|
||||||
let weatherResults: string = "";
|
|
||||||
|
|
||||||
for (let i = 0; i < cityList.length; i++) {
|
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`https://weather.tsukumijima.net/api/forecast/city/${cityList[i]}`,
|
`https://weather.tsukumijima.net/api/forecast/city/${cityList[i]}`,
|
||||||
);
|
);
|
||||||
|
@ -40,25 +37,21 @@ export default async function weatherNotice() {
|
||||||
const minTemp = today.temperature.min?.celsius ?? "取得できませんでした";
|
const minTemp = today.temperature.min?.celsius ?? "取得できませんでした";
|
||||||
const chanceOfRain = data.chanceOfRain?.["T06_12"] ?? "取得できませんでした";
|
const chanceOfRain = data.chanceOfRain?.["T06_12"] ?? "取得できませんでした";
|
||||||
|
|
||||||
weatherResults = weatherResults +
|
|
||||||
`【${data.location.city} 】\n
|
|
||||||
天気:${weather}\n
|
|
||||||
最高気温:${maxTemp}℃\n
|
|
||||||
最低気温:${minTemp}℃\n
|
|
||||||
降水確率:${chanceOfRain}
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(weatherResults);
|
// 天気を返信
|
||||||
|
|
||||||
/*// 天気を返信
|
|
||||||
const resReply = await fetch(
|
const resReply = await fetch(
|
||||||
`https://${process.env.SERVER}/api/ueuse/create`,
|
`https://${process.env.SERVER}/api/ueuse/create`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
token: process.env.TOKEN,
|
token: process.env.TOKEN,
|
||||||
text: weatherResults,
|
text: `
|
||||||
|
【${data.location.city} 】\n
|
||||||
|
天気:${weather}\n
|
||||||
|
最高気温:${maxTemp}℃\n
|
||||||
|
最低気温:${minTemp}℃\n
|
||||||
|
降水確率:${chanceOfRain}
|
||||||
|
`,
|
||||||
replyid: ueuseData.uniqid
|
replyid: ueuseData.uniqid
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -66,5 +59,6 @@ export default async function weatherNotice() {
|
||||||
|
|
||||||
const replyData: types.ueuseCreateApi = await resReply.json();
|
const replyData: types.ueuseCreateApi = await resReply.json();
|
||||||
|
|
||||||
console.log(JSON.stringify(replyData));*/
|
console.log(JSON.stringify(replyData));
|
||||||
|
}, 500)}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue