This commit is contained in:
2025-08-06 21:27:29 +09:00
parent 1ff4b2c429
commit 644ba912b1
28 changed files with 498 additions and 124 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { readFileSync, writeFileSync, existsSync } from "fs";
import { parse, isValid } from 'date-fns/fp';
import { Reply } from "./main.js";
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import config from "../../config.js";
import { Reply } from "./main.js";
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { readFileSync } from "fs";
import { Reply } from "./main.js";
+5 -2
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { readFileSync } from "fs";
import { Reply } from "./main.js";
import config from "../../config.js";
@@ -23,7 +23,7 @@ export default async function Info(data: ueuse) {
let isReport;
if (config.emergency.report) {
if (config.report.isEnabled) {
isReport = "有効";
} else {
isReport = "無効";
@@ -50,6 +50,9 @@ export default async function Info(data: ueuse) {
運営者へ報告が必要ですか?
\`/report\`をご利用ください。
利用規約をお探しですか?
\`/legal terms\`をご利用ください。
プライバシーポリシーをお探しですか?
\`/legal privacy\`をご利用ください。
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { Reply } from "../main.js";
import config from "../../../config.js";
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { Reply } from "../main.js";
import config from "../../../config.js";
+62 -60
View File
@@ -1,6 +1,6 @@
import * as fs from "fs";
import config from "../../config.js";
import type { ueuse } from "types/types.js";
import type { ueuse } from "types/types";
const initialFile: Array<string> = [];
@@ -16,16 +16,16 @@ import Terms from "./legal/terms.js"
import PrivacyPolicy from "./legal/privacy.js";
// 初期化
if (!fs.existsSync("logs/alreadyCommands.json")) {
if (!fs.existsSync("data/alreadyCommands.json")) {
fs.writeFileSync(
"logs/alreadyCommands.json",
"data/alreadyCommands.json",
JSON.stringify(initialFile),
"utf-8",
);
}
// 対応済みユーズ一覧
const alreadyCommands: Array<string> = JSON.parse(fs.readFileSync("logs/alreadyCommands.json", "utf-8"));
const alreadyCommands: Array<string> = JSON.parse(fs.readFileSync("data/alreadyCommands.json", "utf-8"));
function cutAfterChar(str: string, char: string) {
const index = str.indexOf(char);
@@ -57,7 +57,7 @@ function alreadyAdd(data: string) {
alreadyCommands[alreadyCommands.length] = data;
fs.writeFileSync(
"logs/alreadyCommands.json",
"data/alreadyCommands.json",
JSON.stringify(alreadyCommands),
"utf-8",
);
@@ -74,72 +74,74 @@ export default async function Commands() {
}
);
const mentions: Array<ueuse> = await mentionsReq.json();
const mentions: { [key: string]: ueuse } = await mentionsReq.json();
console.log("----------------");
console.log("コマンド処理");
for (let i = 0; i < mentions.length; i++) {
const data = mentions[i];
for (const key in mentions) {
if (mentions.hasOwnProperty(key)) {
const data = mentions[key];
// 除外ユーズ
if (alreadyCommands.indexOf(data.uniqid) !== -1) {
break;
}
// 除外ユーズ
if (alreadyCommands.indexOf(data.uniqid) !== -1) {
break;
}
if (
data.text.charAt(0) === "!" ||
data.text.charAt(0) === "" ||
data.abi === "ignore"
) {
break;
}
if (
data.text.charAt(0) === "!" ||
data.text.charAt(0) === "" ||
data.abi === "ignore"
) {
break;
}
// コマンド処理
console.log("--------");
// コマンド処理
console.log("--------");
const commandName = cutAfterChar(data.text, "/");
const commandName = cutAfterChar(data.text, "/");
alreadyAdd(data.uniqid);
alreadyAdd(data.uniqid);
switch (commandName) {
case "":
break;
case "info":
Info(data);
break;
case "help":
Help(data);
break;
case "legal terms":
Terms(data);
break;
case "legal privacy":
PrivacyPolicy(data);
break;
case "report":
Report(data);
break;
case "follow":
Follow(data);
break;
case "unfollow":
UnFollow(data);
break;
case "weather":
Weather(data);
break;
case "birthday":
Birthday(data);
break;
default:
const reply = await Reply(`
不明なコマンドです。
コマンド実行を除外する場合は1文字目に\`!\`を入れてください。
`, data.uniqid);
switch (commandName) {
case "":
break;
case "info":
Info(data);
break;
case "help":
Help(data);
break;
case "legal terms":
Terms(data);
break;
case "legal privacy":
PrivacyPolicy(data);
break;
case "report":
Report(data);
break;
case "follow":
Follow(data);
break;
case "unfollow":
UnFollow(data);
break;
case "weather":
Weather(data);
break;
case "birthday":
Birthday(data);
break;
default:
const reply = await Reply(`
不明なコマンドです。
コマンド実行を除外する場合は1文字目に\`!\`を入れてください。
`, data.uniqid);
console.log("未対応コマンド: ", reply);
break;
console.log("未対応コマンド: ", reply);
break;
}
}
}
}
+13 -4
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import { Reply } from "./main.js";
import config from "../../config.js";
import sendMail from "../../src/mailer.js";
@@ -15,7 +15,15 @@ export default async function Report(data: ueuse) {
return;
}
if (!config.emergency.mail.function) {
if (!config.emergency.isEnabled) {
console.log("報告(重要通知オフ)", await Reply(`
BOTの運営者によって重要通知が無効化されています。
そのため報告機能はご利用いただけません。
`, data.uniqid));
return;
}
if (!config.emergency.mail.isEnabled) {
console.log("報告(メールオフ)", await Reply(`
BOTの運営者によってメール送信機能が無効化されています。
そのため報告機能はご利用いただけません。
@@ -23,7 +31,7 @@ export default async function Report(data: ueuse) {
return;
}
if (!config.emergency.report) {
if (!config.report.isEnabled) {
console.log("報告(機能オフ)", await Reply(`
BOTの運営者によって報告機能が無効化されています。
そのため報告機能はご利用いただけません。
@@ -49,7 +57,8 @@ export default async function Report(data: ueuse) {
console.log("報告(完了)", await Reply(`
報告が完了しました。
運営者は報告者、ユーズのURL、内容を確認できます。
場合によっては運営者、BOTからブロックされる可能性があります。
--運営者からのメッセージ--
${config.report.message}
`, data.uniqid));
return;
+1 -1
View File
@@ -1,4 +1,4 @@
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
import config from "../../config.js";
import { Reply } from "./main.js";
+1 -1
View File
@@ -1,5 +1,5 @@
import { weatherReply } from "../weatherNotice.js";
import { ueuse } from "types/types.js";
import { ueuse } from "types/types";
export default function Weather(data: ueuse) {
weatherReply(data.uniqid);