This commit is contained in:
2025-08-27 01:21:23 +09:00
parent b9a4fe8763
commit 81e9bea8ab
18 changed files with 368 additions and 63 deletions
+24 -6
View File
@@ -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);
+4
View File
@@ -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);
+11 -2
View File
@@ -28,7 +28,8 @@ if (!fs.existsSync("data/alreadyCommands.json")) {
}
// 対応済みユーズ一覧
const alreadyCommands: Array<string> = JSON.parse(fs.readFileSync("data/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);
@@ -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;
}
+59 -39
View File
@@ -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);
+18 -10
View File
@@ -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);
+1
View File
@@ -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);
+4
View File
@@ -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);
+4
View File
@@ -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)}`);
+4
View File
@@ -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);
+4
View File
@@ -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("----------------");
+8
View File
@@ -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)}`);