Closed kiyokunbotv2 closed 3 months ago
const axios = require("axios"); const fs = require("fs");
const history = {}; let isFontEnabled = true;
module.exports.config = { name: "Nyx", version: "3.1", hasPermssion: 0, credits: "Hazeyy", description: "( π°πΈ-πΆπππππππππ π‘ π°ππππ ππ πππ‘π πππ πΈππππ πΏπππππ )", commandCategory: "ππ ππππππ‘", usages: "( π³πππ ππ π°ππ πππππππππ π πππ π’πππ πΆπππππππππ )", cooldowns: 3, };
async function handleNyxImageCommand(api, event) { const args = event.body.split(/\s+/); args.shift(); const tzt = args.join(' ').split('-').map(item => item.trim()); const txt = tzt[0]; const txt2 = tzt.slice(1).join(' ');
if (!txt || !txt2) { return api.sendMessage("π π·ππππ ππ πππ π½π’π‘ π°πΈ π πππ ππππππ.\n\nπππ: ππ’π‘ππππ [ ππππππ ] - [ πππππ ] ππππ πππ 1-20.", event.threadID, event.messageID); }
api.sendMessage("π¨οΈ | π½π’π‘ π°πΈ πΆπππππππππ ππππππ, πΏπππππ π πππ...", event.threadID, event.messageID);
try { const enctxt = encodeURI(txt); const url = https://hazeyy-api-img-prompt.kyrinwu.repl.co/api/img/prompt?prompt=${enctxt}&model=${txt2}; const responses = await Promise.all( Array.from({ length: 4 }, async (_, index) => { const response = await axios.get(url, { responseType: "arraybuffer" }); return response.data; }) );
https://hazeyy-api-img-prompt.kyrinwu.repl.co/api/img/prompt?prompt=${enctxt}&model=${txt2}
const paths = []; responses.forEach((data, index) => { const path = __dirname + `/cache/image${index + 1}.png`; fs.writeFileSync(path, Buffer.from(data, "binary")); paths.push(path); }); const senderName = "π π½π’π‘ ( π°πΈ )"; const message = `${senderName}\n\nπ·πππ'π π’πππ πΈππππ ππππππ`; const combinedMessage = { body: message, attachment: paths.map((path) => fs.createReadStream(path)), }; api.sendMessage(combinedMessage, event.threadID, () => paths.forEach(fs.unlinkSync));
} catch (e) { api.sendMessage("π« π΄ππππ ππ πΈππππ πΆπππππππππ", event.threadID, event.messageID); } }
async function convertVoiceToText(audioUrl, api, event) { try { api.sendMessage("π½ | π½π’π‘ π°πΈ π²πππππππππ π°ππππ, πΏπππππ π πππ...", event.threadID);
const response = await axios.get(`https://hazeyy-apis-combine.kyrinwu.repl.co/api/try/voice2text?url=${encodeURIComponent(audioUrl)}`); const text = response.data.transcription; if (text && isFontEnabled) { const formattedText = formatFont(text); api.sendMessage(`π π½π’π‘ ( π°πΈ ) π²πππππ‘π πΆ\n\n ${formattedText}`, event.threadID, event.messageID); } else if (text) { api.sendMessage(`π π½π’π‘ ( π°πΈ ) π²πππππ‘π πΆ\n\n ${text}`, event.threadID, event.messageID); } else { api.sendMessage("π« ππππππ ππ πππππππ πππππ.", event.threadID, event.messageID); }
} catch (error) { console.error("π« π΄ππππ πππππππ π ππππ ππππππππππ πππππ:", error); api.sendMessage("π« π°π πππππ πππππππ π ππππ ππππππππππ πππππ.", event.threadID, event.messageID); } }
module.exports.handleEvent = async function ({ api, event, Users }) { if (!(event.body.toLowerCase().startsWith("nyx") || event.body.toLowerCase().startsWith("Nyx"))) return;
if (event.body.toLowerCase().startsWith("nyxmage")) { handleNyxImageCommand(api, event); return; }
const args = event.body.split(/\s+/); args.shift();
if (args[0] === "font" && (args[1] === "on" || args[1] === "off")) { isFontEnabled = args[1] === "on";
api.sendMessage(`π π΅πππ ππππππππππ\n\nβ°β€ [ ${isFontEnabled ? "πππππππ π’" : "ππππππππ π΄"} ]`, event.threadID); return;
}
if (event.type === "message_reply") { if (event.messageReply.attachments[0]) { const attachment = event.messageReply.attachments[0];
if (attachment.type === "audio") { const audioUrl = attachment.url; convertVoiceToText(audioUrl, api, event); return; } }
let text = args.join(" ");
if (!text) { return api.sendMessage("π π·ππππ πΈ ππ π½π’π‘ π°πΈ π’πππ πππππππ π°πΈ πΆπππππππππ.\n\nπΏπππππ πππππππ π ( πππππ’ ) ππ ππππππ ππ ππ ππππ π πππ π’πππ π°πΈ πΆπππππππππ.", event.threadID, event.messageID); }
if (!history.hasOwnProperty(event.senderID)) history[event.senderID] = []; history[event.senderID].push({ role: "user", content: text });
try { api.sendMessage("π¨οΈ | π½π’π‘ π°πΈ ππ ππππππππ...", event.threadID, event.messageID);
let senderName = (await Users.getData(event.senderID)).name; let { data } = await axios.post("https://hazeyy-apis-combine.kyrinwu.repl.co/api/girlfriend", { messages: history[event.senderID], sender_name: senderName }); if (data && data.content) { history[event.senderID].push(data); const formattedResponse = isFontEnabled ? `π π½π’π‘ ( π°πΈ )\n\nβ π°ππ: '${text}'\n\n${formatFont(data.content)}` : `π π½π’π‘ ( π°πΈ )\n\nβ π°ππ: '${text}'\n\n${data.content}`; api.sendMessage(formattedResponse, event.threadID, event.messageID); } else { api.sendMessage("π« π°πΏπΈ ππππππππ ππ πππππ’ ππ πππππππππ.", event.threadID); }
} catch (error) { console.error("π« π΄ππππ ππππππ π°πΏπΈ πππππππ:", error); return api.sendMessage("π« π°π πππππ πππππππ π ππππ ππππππππππ πππππππ. πΏπππππ πππ’ πππππ πππππ.", event.threadID, event.messageID); } };
function formatFont(text) { const fontMapping = { a: "π", b: "π", c: "π", d: "π", e: "π", f: "π", g: "π", h: "π", i: "π", j: "π", k: "π", l: "π", m: "π", n: "π", o: "π", p: "π", q: "π", r: "π", s: "π", t: "π", u: "π", v: "π", w: "π ", x: "π‘", y: "π’", z: "π£", A: "π°", B: "π±", C: "π²", D: "π³", E: "π΄", F: "π΅", G: "πΆ", H: "π·", I: "πΈ", J: "πΉ", K: "πΊ", L: "π»", M: "πΌ", N: "π½", O: "πΎ", P: "πΏ", Q: "π", R: "π", S: "π", T: "π", U: "π", V: "π ", W: "π", X: "π", Y: "π", Z: "π" };
let formattedText = ""; for (const char of text) { formattedText += char in fontMapping ? fontMapping[char] : char; }
return formattedText; }
module.exports.run = async function ({ api, event }) {};
wth is this? You came to the wrong repo.
const axios = require("axios"); const fs = require("fs");
const history = {}; let isFontEnabled = true;
module.exports.config = { name: "Nyx", version: "3.1", hasPermssion: 0, credits: "Hazeyy", description: "( π°πΈ-πΆπππππππππ π‘ π°ππππ ππ πππ‘π πππ πΈππππ πΏπππππ )", commandCategory: "ππ ππππππ‘", usages: "( π³πππ ππ π°ππ πππππππππ π πππ π’πππ πΆπππππππππ )", cooldowns: 3, };
async function handleNyxImageCommand(api, event) { const args = event.body.split(/\s+/); args.shift(); const tzt = args.join(' ').split('-').map(item => item.trim()); const txt = tzt[0]; const txt2 = tzt.slice(1).join(' ');
if (!txt || !txt2) { return api.sendMessage("π π·ππππ ππ πππ π½π’π‘ π°πΈ π πππ ππππππ.\n\nπππ: ππ’π‘ππππ [ ππππππ ] - [ πππππ ] ππππ πππ 1-20.", event.threadID, event.messageID); }
api.sendMessage("π¨οΈ | π½π’π‘ π°πΈ πΆπππππππππ ππππππ, πΏπππππ π πππ...", event.threadID, event.messageID);
try { const enctxt = encodeURI(txt); const url =
https://hazeyy-api-img-prompt.kyrinwu.repl.co/api/img/prompt?prompt=${enctxt}&model=${txt2}
; const responses = await Promise.all( Array.from({ length: 4 }, async (_, index) => { const response = await axios.get(url, { responseType: "arraybuffer" }); return response.data; }) );} catch (e) { api.sendMessage("π« π΄ππππ ππ πΈππππ πΆπππππππππ", event.threadID, event.messageID); } }
async function convertVoiceToText(audioUrl, api, event) { try { api.sendMessage("π½ | π½π’π‘ π°πΈ π²πππππππππ π°ππππ, πΏπππππ π πππ...", event.threadID);
} catch (error) { console.error("π« π΄ππππ πππππππ π ππππ ππππππππππ πππππ:", error); api.sendMessage("π« π°π πππππ πππππππ π ππππ ππππππππππ πππππ.", event.threadID, event.messageID); } }
module.exports.handleEvent = async function ({ api, event, Users }) { if (!(event.body.toLowerCase().startsWith("nyx") || event.body.toLowerCase().startsWith("Nyx"))) return;
if (event.body.toLowerCase().startsWith("nyxmage")) { handleNyxImageCommand(api, event); return; }
const args = event.body.split(/\s+/); args.shift();
if (args[0] === "font" && (args[1] === "on" || args[1] === "off")) { isFontEnabled = args[1] === "on";
}
if (event.type === "message_reply") { if (event.messageReply.attachments[0]) { const attachment = event.messageReply.attachments[0];
}
let text = args.join(" ");
if (!text) { return api.sendMessage("π π·ππππ πΈ ππ π½π’π‘ π°πΈ π’πππ πππππππ π°πΈ πΆπππππππππ.\n\nπΏπππππ πππππππ π ( πππππ’ ) ππ ππππππ ππ ππ ππππ π πππ π’πππ π°πΈ πΆπππππππππ.", event.threadID, event.messageID); }
if (!history.hasOwnProperty(event.senderID)) history[event.senderID] = []; history[event.senderID].push({ role: "user", content: text });
try { api.sendMessage("π¨οΈ | π½π’π‘ π°πΈ ππ ππππππππ...", event.threadID, event.messageID);
} catch (error) { console.error("π« π΄ππππ ππππππ π°πΏπΈ πππππππ:", error); return api.sendMessage("π« π°π πππππ πππππππ π ππππ ππππππππππ πππππππ. πΏπππππ πππ’ πππππ πππππ.", event.threadID, event.messageID); } };
function formatFont(text) { const fontMapping = { a: "π", b: "π", c: "π", d: "π", e: "π", f: "π", g: "π", h: "π", i: "π", j: "π", k: "π", l: "π", m: "π", n: "π", o: "π", p: "π", q: "π", r: "π", s: "π", t: "π", u: "π", v: "π", w: "π ", x: "π‘", y: "π’", z: "π£", A: "π°", B: "π±", C: "π²", D: "π³", E: "π΄", F: "π΅", G: "πΆ", H: "π·", I: "πΈ", J: "πΉ", K: "πΊ", L: "π»", M: "πΌ", N: "π½", O: "πΎ", P: "πΏ", Q: "π", R: "π", S: "π", T: "π", U: "π", V: "π ", W: "π", X: "π", Y: "π", Z: "π" };
let formattedText = ""; for (const char of text) { formattedText += char in fontMapping ? fontMapping[char] : char; }
return formattedText; }
module.exports.run = async function ({ api, event }) {};