DifferentMe AI: Ubah Gambar Menjadi Gaya Anime dan Lainnya
import axios from "axios";
const handler = async (m, { conn, args, usedPrefix, command }) => { conn.differentMe = conn.differentMe ? conn.differentMe : {}; if (m.sender in conn.differentMe) { return m.reply("Mohon Tunggu Sebentar, Masih Ada Proses Yang Belum Selesai"); }
const q = m.quoted ? m.quoted : m;
const mime = (q.msg || q).mimetype || q.mediaType || "";
if (!mime) {
return m.reply(`Balas/Kirim Gambar Dengan Caption *${usedPrefix + command}*`);
}
if (!/image\/(jpe?g|png)/.test(mime)) {
return m.reply(`File Tidak Support!`);
}
conn["differentMe"][m.sender] = true;
const [style = "anime"] = args;
m.reply(`_Generating image using style ${style}_`);
const imgBuffer = await q.download();
const form = new FormData();
const blob = new Blob([imgBuffer], { type: "image/jpg" });
form.append("file", blob, "image.jpg");
const { data } = await axios
.request({
baseURL: 'https://api.itsrose.life',
url: "/image/differentMe",
method: "POST",
params: {
style,
json: true,
apikey: global.rose,
},
data: form,
}).catch((e) => e?.response);
const { status, result, message, styles } = data;
if (!status) {
delete conn.differentMe[m.sender];
let count = 1,extra_msg = "";
if (styles && Array.isArray(styles)) {
extra_msg += "Berbagai Style Yang Tersedia\n\n"
for (const id of styles) {
extra_msg += `${count}. ${id}\n`;
count += 1;
}
}
return await conn.sendMessage(
m.chat,
{
text: message + extra_msg,
},
{ quoted: m }
);
}
await conn.sendMessage(
m.chat,
{
image: Buffer.from(result["base64Image"], "base64"),
caption: `_Different For You_`,
},
{ quoted: m }
);
delete conn.differentMe[m.sender];
};
handler.help = ["differentme"]; handler.tags = ["ai"]; handler.command = ["differentme"]; handler.limit = true;
export default handler;
原文地址: https://www.cveoy.top/t/topic/ml8Q 著作权归作者所有。请勿转载和采集!