57 lines
1.5 KiB (Stored with Git LFS)
TypeScript
57 lines
1.5 KiB (Stored with Git LFS)
TypeScript
import { ueuse } from "../../types/types";
|
||
import MiQ from "../../miq/main.js";
|
||
import config from "../../config.js";
|
||
|
||
export default async function MakeItAQuote(data: ueuse) {
|
||
let color: boolean;
|
||
let msg: string;
|
||
|
||
if (data.abi === "color: true") {
|
||
msg = "カラーモードでMake it a quoteを生成しました。";
|
||
color = true;
|
||
} else if (data.abi === "color: false") {
|
||
msg = "モノクロモードでMake it a quoteを生成しました。";
|
||
color = false;
|
||
} else {
|
||
msg = "ご指定がないためモノクロモードでMake it a quoteを生成しました。";
|
||
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"];
|
||
|
||
console.log(ueuseData)
|
||
|
||
const img = await MiQ({
|
||
type: "Base64Data",
|
||
color: color,
|
||
text: ueuseData.text,
|
||
iconURL: ueuseData.account.user_icon,
|
||
userName: ueuseData.account.username,
|
||
userID: ueuseData.account.userid,
|
||
});
|
||
|
||
const req = await fetch(`${config.uwuzu.host}/api/ueuse/create`, {
|
||
method: "POST",
|
||
body: JSON.stringify({
|
||
token: config.uwuzu.apiToken,
|
||
text: msg,
|
||
image1: img,
|
||
replyid: data.uniqid,
|
||
}),
|
||
cache: "no-store",
|
||
});
|
||
|
||
const res = await req.json();
|
||
|
||
console.log("MiQ:", res);
|
||
}
|