goat
command
4k
Enhance or restore image quality using 4k AI.
0
views
0
likes
0
installs
raw source
const axios = require("axios");
const mahmud = async () => {
const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json");
return base.data.mahmud;
};
/**
* @author MahMUD
* @author: do not delete it
*/
module.exports = {
config: {
name: "4k",
version: "1.7",
author: "๐ฉ๐
๐๐ท๐พ๐๐ช ๐๐๐พ",
countDown: 10,
role: 0,
category: "AI",
description: "Enhance or restore image quality using 4k AI.",
guide: {
en: "{pn} [url] or reply with image"
}
},
onStart: async function ({ message, event, args }) {
const startTime = Date.now();
let imgUrl;
if (event.messageReply?.attachments?.[0]?.type === "photo") {
imgUrl = event.messageReply.attachments[0].url;
}
else if (args[0]) {
imgUrl = args.join(" ");
}
if (!imgUrl) {
return message.reply("Baby, Please reply to an image or provide an image URL");
}
const waitMsg = await message.reply("๐๐จ๐๐๐ข๐ง๐ ๐๐ค ๐ข๐ฆ๐๐ ๐...๐ฐ๐๐ข๐ญ ๐๐๐๐ฒ <๐");
message.reaction("๐", event.messageID);
try {
const apiUrl = `${await mahmud()}/api/hd?imgUrl=${encodeURIComponent(imgUrl)}`;
const res = await axios.get(apiUrl, { responseType: "stream" });
if (waitMsg?.messageID) message.unsend(waitMsg.messageID);
message.reaction("โ
", event.messageID);
const processTime = ((Date.now() - startTime) / 1000).toFixed(2);
message.reply({
body: `โ
| ๐๐๐ซ๐'๐ฌ ๐ฒ๐จ๐ฎ๐ซ ๐๐ค ๐ข๐ฆ๐๐ ๐ ๐๐๐๐ฒ`,
attachment: res.data
});
} catch (error) {
if (waitMsg?.messageID) message.unsend(waitMsg.messageID);
message.reaction("โ", event.messageID);
message.reply(`๐ฅนerror baby, contact ๐ฉ๐
๐๐ท๐พ๐๐ช ๐๐๐พ.`);
}
}
};