diff --git a/checks/api.ts b/checks/api.ts index 3111cfe..9eb4056 100644 --- a/checks/api.ts +++ b/checks/api.ts @@ -11,6 +11,11 @@ export default async function APICheck() { cache: "no-store", }); + if (req.status < 200 || req.status > 299) { + console.log(styleText("red", "uwuzuサーバーから正常な返答がありませんでした")); + process.exit(); + } + const res = await req.json(); if (res.error_code !== undefined) { diff --git a/checks/version.ts b/checks/version.ts index d5027c9..0bbbacb 100644 --- a/checks/version.ts +++ b/checks/version.ts @@ -26,7 +26,7 @@ export default async function VersionCheck() { const releaseUrl = `${packageJson.repository.url}/releases/tag/${packageJson.tag}`; - await fetch(`${config.uwuzu.host}/api/ueuse/create`, { + const req = await fetch(`${config.uwuzu.host}/api/ueuse/create`, { method: "POST", body: JSON.stringify({ token: config.uwuzu.apiToken, @@ -37,6 +37,12 @@ export default async function VersionCheck() { }), cache: "no-store", }); + + if (req.status < 200 || req.status > 299) { + return; + } + + console.log("アップデート通知:", await req.json()); } catch (err) { console.log("アップデート通知にエラーが発生しました: ", err); } diff --git a/main.ts b/main.ts index 46b4bf8..db54ccb 100644 --- a/main.ts +++ b/main.ts @@ -48,7 +48,6 @@ cron.schedule("0 7 * * *", () => { // 管理パネル import AdminPanel from "./panel/main.js"; -import { styleText } from "util"; (async () => { await AdminPanel(); })(); @@ -57,6 +56,7 @@ import { styleText } from "util"; console.log("BOTサーバーが起動しました"); import config from "./config.js"; +import { styleText } from "util"; if (config.debug !== undefined) { process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; console.log(styleText(["bgRed", "cyan", "bold"], "デバッグモードで起動中")); diff --git a/miq/PersonIcon.txt b/miq/PersonIcon.txt new file mode 100644 index 0000000..935b78d --- /dev/null +++ b/miq/PersonIcon.txt @@ -0,0 +1 @@ +data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAgAElEQVR4Xu3dB7itZ1Un8KuCBgFFkhGQAKEZOiG0KIyENoSSBzCCUnSCIEUQRGoIisrQhl6EIEh5aKOUUOJQpAQIg5QAA0ETBKmhaAaiZiQUeWa98p1he7m5Ofeevb79vt/6fc/zPufkcvb7rfVbn+7/2WeXH9nlIECAAAECBMoJ/Ei5jjVMgAABAgQI7BIAXAQECBAgQKCggABQcOhaJkCAAAECAoBrgAABAgQIFBQQAAoOXcsECBAgQEAAcA0QIECAAIGCAgJAwaFrmQABAgQICACuAQIECBAgUFBAACg4dC0TIECAAAEBwDVAgAABAgQKCggABYeuZQIECBAgIAC4BggQIECAQEEBAaDg0LVMgAABAgQEANcAAQIECBAoKCAAFBy6lgkQIECAgADgGiBAgAABAgUFBICCQ9cyAQIECBAQAFwDBAgQIECgoIAAUHDoWiZAgAABAgKAa4AAAQIECBQUEAAKDl3LBAgQIEBAAHANECBAgACBggICQMGha5kAAQIECAgArgECBAgQIFBQQAAoOHQtEyBAgAABAcA1QIAAAQIECgoIAAWHrmUCBAgQICAAuAYIECBAgEBBAQGg4NC1TIAAAQIEBADXAAECBAgQKCggABQcupYJECBAgIAA4BogQIAAAQIFBQSAgkPXMgECBAgQEABcAwQIECBAoKCAAFBw6FomQIAAAQICgGuAAAECBAgUFBAACg5dywQIECBAQABwDRAgQIAAgYICAkDBoWuZAAECBAgIAK4BAgQIECBQUEAAKDh0LRMgQIAAAQHANUCAAAECBAoKCAAFh65lAgQIECAgALgGCBAgQIBAQQEBoODQtUyAAAECBAQA1wABAgQIECgoIAAUHLqWCRAgQICAAOAaIECAAAECBQUEgIJD1zIBAgQIEBAAXAMECBAgQKCggABQcOhaJkCAAAECAoBrgAABAgQIFBQQAAoOXcsECBAgQEAAcA0QIECAAIGCAgJAwaFrmQABAgQICACuAQIECBAgUFBAACg4dC0TIECAAAEBwDVAgAABAgQKCggABYeuZQIECBAgIAC4BggQIECAQEEBAaDg0LVMgAABAgQEANcAAQIECBAoKCAAFBy6lgkQIECAgADgGiBAgAABAgUFBICCQ9cyAQIECBAQAFwDBAgQIECgoIAAUHDoWiZAgAABAgKAa4AAAQIECBQUEA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4FTURIECAAIFkAQEgGdj2BAgQIECgRwEBoMepqIkAAQIECCQLCADJwLYnQIAAAQI9CggAPU5FTQQIECBAIFlAAEgGtj0BAgQIEOhRQADocSpqIkCAAAECyQICQDKw7QkQIECAQI8CAkCPU1ETAQIECBBIFhAAkoFtT4AAAQIEehQQAHqcipoIECBAgECygACQDGx7AgQIECDQo4AA0ONU1ESAAAECBJIFBIBkYNsTIECAAIEeBQSAHqeiJgIECBAgkCwgACQD254AAQIECPQoIAD0OBU1ESBAgACBZAEBIBnY9gQIECBAoEcBAaDHqaiJAAECBAgkCwgAycC2J0CAAAECPQoIAD1ORU0ECBAgQCBZQABIBrY9AQIECBDoUUAA6HEqaiJAgAABAskCAkAysO0JECBAgECPAgJAj1NREwECBAgQSBYQAJKBbU+AAAECBHoU+H9oyrUucsxeIAAAAABJRU5ErkJggg== diff --git a/miq/PersonIconLICENSE b/miq/PersonIconLICENSE new file mode 100644 index 0000000..75b5248 --- /dev/null +++ b/miq/PersonIconLICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/miq/main.ts b/miq/main.ts index 289ba3b..fb8465b 100644 --- a/miq/main.ts +++ b/miq/main.ts @@ -1,6 +1,7 @@ import { createCanvas, loadImage, registerFont } from "canvas"; import sharp from "sharp"; import { MiQOptions } from "./miq"; +import { readFileSync } from "fs"; // フォント読み込み registerFont("miq/fonts/MPLUS.ttf", { @@ -77,10 +78,16 @@ async function iconReplace( ) { let result = ""; - const buffer = await(await fetch(iconURL, { + const bufferReq = await fetch(iconURL, { method: "GET", cache: "no-store", - })).arrayBuffer(); + }); + + if (bufferReq.status < 200 || bufferReq.status > 299) { + return readFileSync("miq/PersonIcon.txt", "utf-8"); + } + + const buffer = await bufferReq.arrayBuffer(); if (color) { const img = await sharp(Buffer.from(buffer)) diff --git a/package.json b/package.json index 79df8d4..2207aaf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "notice-uwuzu", - "version": "v25.8.9@uwuzu1.6.4", - "tag": "v25.8.9", + "version": "v25.8.10@uwuzu1.6.4", + "tag": "v25.8.10", "description": "Notice Bot for uwuzu", "main": "dist/main.js", "scripts": { diff --git a/scripts/commands/delete.ts b/scripts/commands/delete.ts index 6a392e3..3711d82 100644 --- a/scripts/commands/delete.ts +++ b/scripts/commands/delete.ts @@ -3,32 +3,50 @@ import config from "../../config.js"; import { Reply } from "./main.js"; export default async function Delete(data: ueuse) { - const me: meApi = await (await fetch(`${config.uwuzu.host}/api/me/`, { + const meReq = await fetch(`${config.uwuzu.host}/api/me/`, { method: "POST", cache: "no-store", body: JSON.stringify({ token: config.uwuzu.apiToken, }), - })).json() + }); - const replyUeuse: ueuse = (await (await fetch(`${config.uwuzu.host}/api/ueuse/get`, { + if (meReq.status < 200 || meReq.status > 299) { + return; + } + + const me: meApi = await meReq.json(); + + const replyUeuseReq = await fetch(`${config.uwuzu.host}/api/ueuse/get`, { method: "POST", cache: "no-store", body: JSON.stringify({ token: config.uwuzu.apiToken, uniqid: data.replyid, }), - })).json())["0"]; + }); + + if (replyUeuseReq.status < 200 || replyUeuseReq.status > 299) { + return; + } + + const replyUeuse: ueuse = (await replyUeuseReq.json())["0"]; if (me.userid === replyUeuse.account.userid) { - const ueuseDelete = await (await fetch(`${config.uwuzu.host}/api/ueuse/delete`, { + const ueuseDeleteReq = await fetch(`${config.uwuzu.host}/api/ueuse/delete`, { method: "POST", cache: "no-store", body: JSON.stringify({ token: config.uwuzu.apiToken, uniqid: data.replyid, }), - })).json(); + }); + + if (ueuseDeleteReq.status < 200 || ueuseDeleteReq.status > 299) { + return; + } + + const ueuseDelete = await ueuseDeleteReq.json(); console.log("削除:", ueuseDelete); diff --git a/scripts/commands/follow.ts b/scripts/commands/follow.ts index 785bb9e..c9ae125 100644 --- a/scripts/commands/follow.ts +++ b/scripts/commands/follow.ts @@ -12,6 +12,10 @@ export default async function Follow(data: ueuse) { cache: "no-store", }); + if (followReq.status < 200 || followReq.status > 299) { + return; + } + const followRes = await followReq.json(); console.log("フォロー: ", followRes); diff --git a/scripts/commands/main.ts b/scripts/commands/main.ts index ca697f4..ea072ee 100644 --- a/scripts/commands/main.ts +++ b/scripts/commands/main.ts @@ -28,7 +28,8 @@ if (!fs.existsSync("data/alreadyCommands.json")) { } // 対応済みユーズ一覧 -const alreadyCommands: Array = JSON.parse(fs.readFileSync("data/alreadyCommands.json", "utf-8")); +const alreadyCommands: Array = +JSON.parse(fs.readFileSync("data/alreadyCommands.json", "utf-8")); function cutAfterChar(str: string, char: string) { const index = str.indexOf(char); @@ -88,6 +89,10 @@ export async function Reply(text: string, reply: string) { cache: "no-store", }); + if (req.status < 200 || req.status > 299) { + return; + } + const res = await req.json(); return res; @@ -114,6 +119,10 @@ export default async function Commands() { } ); + if (mentionsReq.status < 200 || mentionsReq.status > 299) { + return; + } + const mentions: { [key: string]: ueuse } = await mentionsReq.json(); console.log("----------------"); @@ -135,7 +144,7 @@ export default async function Commands() { if ( data.text.charAt(0) === "!" || data.text.charAt(0) === "!" || - data.abi === "ignore" + data.abi.indexOf("ignore") !== -1 ) { break; } diff --git a/scripts/commands/miq/allow.ts b/scripts/commands/miq/allow.ts index 44c6d60..ad77537 100644 --- a/scripts/commands/miq/allow.ts +++ b/scripts/commands/miq/allow.ts @@ -32,26 +32,34 @@ export default async function MiQAllow(data: ueuse) { return; } - const confirmUeuse: ueuse = (await ( - await fetch(`${config.uwuzu.host}/api/ueuse/get`, { - method: "POST", - cache: "no-store", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - uniqid: data.replyid, - }), - }) - ).json())["0"]; + const confirmUeuseReq = await fetch(`${config.uwuzu.host}/api/ueuse/get`, { + method: "POST", + cache: "no-store", + body: JSON.stringify({ + token: config.uwuzu.apiToken, + uniqid: data.replyid, + }), + }); - const me: meApi = await ( - await fetch(`${config.uwuzu.host}/api/me/`, { - method: "POST", - cache: "no-store", - body: JSON.stringify({ - token: config.uwuzu.apiToken - }), - }) - ).json() + if (confirmUeuseReq.status < 200 || confirmUeuseReq.status > 299) { + return; + } + + const confirmUeuse: ueuse = (await confirmUeuseReq.json())["0"]; + + const meReq = await fetch(`${config.uwuzu.host}/api/me/`, { + method: "POST", + cache: "no-store", + body: JSON.stringify({ + token: config.uwuzu.apiToken + }), + }); + + if (meReq.status < 200 || meReq.status > 299) { + return; + } + + const me: meApi = await meReq.json() if (confirmUeuse.account.userid !== me.userid) { console.log("MiQ許可制(誤アカウント):", await Reply(` @@ -67,16 +75,20 @@ export default async function MiQAllow(data: ueuse) { return; } - const requestUeuse: ueuse = (await ( - await fetch(`${config.uwuzu.host}/api/ueuse/get`, { - method: "POST", - cache: "no-store", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - uniqid: confirmUeuse.replyid, - }), - }) - ).json())["0"]; + const requestUeuseReq = await fetch(`${config.uwuzu.host}/api/ueuse/get`, { + method: "POST", + cache: "no-store", + body: JSON.stringify({ + token: config.uwuzu.apiToken, + uniqid: confirmUeuse.replyid, + }), + }); + + if (requestUeuseReq.status < 200 || requestUeuseReq.status > 299) { + return; + } + + const requestUeuse: ueuse = (await requestUeuseReq.json())["0"]; if (requestUeuse.replyid === "") { console.log("MiQ許可制(誤ユーズ):", await Reply(` @@ -85,16 +97,20 @@ export default async function MiQAllow(data: ueuse) { return; } - const miqUeuse: ueuse = (await ( - await fetch(`${config.uwuzu.host}/api/ueuse/get`, { - method: "POST", - cache: "no-store", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - uniqid: requestUeuse.replyid, - }), - }) - ).json())["0"]; + const miqUeuseReq = await fetch(`${config.uwuzu.host}/api/ueuse/get`, { + method: "POST", + cache: "no-store", + body: JSON.stringify({ + token: config.uwuzu.apiToken, + uniqid: requestUeuse.replyid, + }), + }); + + if (miqUeuseReq.status < 200 || miqUeuseReq.status > 299) { + return; + } + + const miqUeuse: ueuse = (await miqUeuseReq.json())["0"]; let color: boolean; let msg: string; @@ -130,6 +146,10 @@ export default async function MiQAllow(data: ueuse) { cache: "no-store", }); + if (req.status < 200 || req.status > 299) { + return; + } + const res = await req.json(); console.log("MiQ(許可制):", res); diff --git a/scripts/commands/miq/main.ts b/scripts/commands/miq/main.ts index c4893a1..a208092 100644 --- a/scripts/commands/miq/main.ts +++ b/scripts/commands/miq/main.ts @@ -28,16 +28,20 @@ export default async function MakeItAQuote(data: ueuse) { color = false; } - const ueuseData: ueuse = (await ( - await fetch(`${config.uwuzu.host}/api/ueuse/get`, { - method: "POST", - cache: "no-store", - body: JSON.stringify({ - token: config.uwuzu.apiToken, - uniqid: data.replyid, - }), - }) - ).json())["0"]; + const ueuseDataReq = await fetch(`${config.uwuzu.host}/api/ueuse/get`, { + method: "POST", + cache: "no-store", + body: JSON.stringify({ + token: config.uwuzu.apiToken, + uniqid: data.replyid, + }), + }); + + if (ueuseDataReq.status < 200 || ueuseDataReq.status > 299) { + return; + } + + const ueuseData: ueuse = (await ueuseDataReq.json())["0"]; console.log(ueuseData); @@ -96,6 +100,10 @@ export default async function MakeItAQuote(data: ueuse) { cache: "no-store", }); + if (req.status < 200 || req.status > 299) { + return; + } + const res = await req.json(); console.log("MiQ:", res); diff --git a/scripts/commands/miq/permission.ts b/scripts/commands/miq/permission.ts index 94ce420..e8593b5 100644 --- a/scripts/commands/miq/permission.ts +++ b/scripts/commands/miq/permission.ts @@ -72,6 +72,7 @@ export default async function MiQPermission(data: ueuse) { JSON.stringify(permissions), "utf-8" ); + await Reply(` あなたに対してのMake it a Quoteを生成するための権限を「${PermissionsNames[requestPermission]}」に変更しました。 `, data.uniqid); diff --git a/scripts/commands/unfollow.ts b/scripts/commands/unfollow.ts index 0407ad9..6d51600 100644 --- a/scripts/commands/unfollow.ts +++ b/scripts/commands/unfollow.ts @@ -12,6 +12,10 @@ export default async function UnFollow(data: ueuse) { cache: "no-store", }); + if (unfollowReq.status < 200 || unfollowReq.status > 299) { + return; + } + const unfollowRes = await unfollowReq.json(); console.log("フォロー解除: ", unfollowRes); diff --git a/scripts/earthquakeNotice.ts b/scripts/earthquakeNotice.ts index ecdc6bb..034b630 100644 --- a/scripts/earthquakeNotice.ts +++ b/scripts/earthquakeNotice.ts @@ -494,6 +494,10 @@ async function ueuse(text: string) { cache: "no-store", }); + if (res.status < 200 || res.status > 299) { + return; + } + const resData = await res.json(); console.log(`地震情報投稿:${JSON.stringify(resData)}`); diff --git a/scripts/eventday.ts b/scripts/eventday.ts index 17f55c3..ba69b42 100644 --- a/scripts/eventday.ts +++ b/scripts/eventday.ts @@ -22,6 +22,10 @@ export default async function EventDays() { }), }); + if (req.status < 200 || req.status > 299) { + return; + } + const res = await req.json(); console.log("祝日等ユーズ:", res); diff --git a/scripts/timeNotice.ts b/scripts/timeNotice.ts index 980eaa7..da5b5bc 100644 --- a/scripts/timeNotice.ts +++ b/scripts/timeNotice.ts @@ -39,6 +39,10 @@ export default async function timeNotice() { }, ); + if (resUeuse.status < 200 || resUeuse.status > 299) { + return; + } + const ueuseData: types.ueuseCreateApi = await resUeuse.json(); console.log("----------------"); diff --git a/scripts/weatherNotice.ts b/scripts/weatherNotice.ts index 47cd378..e310230 100644 --- a/scripts/weatherNotice.ts +++ b/scripts/weatherNotice.ts @@ -23,6 +23,10 @@ export async function weatherNotice() { }, ); + if (resUeuse.status < 200 || resUeuse.status > 299) { + return; + } + const ueuseData: types.ueuseCreateApi = await resUeuse.json(); console.log(`天気仮投稿:${JSON.stringify(ueuseData)}`); @@ -119,6 +123,10 @@ export async function weatherReply(uniqid: string) { }, ); + if (resReply.status < 200 || resReply.status > 299) { + return; + } + const replyData: types.ueuseCreateApi = await resReply.json(); console.log(`天気返信:${JSON.stringify(replyData)}`);