v25.8.10
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user