const axios = require("axios"); const fs = require("fs-extra"); const path = require("path"); const LOVE_CAPTIONS = [ "💛🌸\nāϤ⧁āĻŽāĻŋ āφāϰ āφāĻŽāĻŋ...\nāĻāĻ•āϟāĻž āĻ…āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻ—āĻ˛ā§āĻĒ⧇āϰ āĻĻ⧁āχāϟāĻž āĻĒāĻžāϤāĻž đŸĢļ", "đŸŒģ💛\nāύāĻžāĻŽ āĻļ⧁āύāϞ⧇āχ āĻŽāύāϟāĻž āĻšāĻžāϞāĻ•āĻž āĻšā§Ÿā§‡ āϝāĻžā§Ÿ,\nāĻāχ āĻ…āύ⧁āĻ­ā§‚āϤāĻŋāϟāĻžāϰ āύāĻžāĻŽāχ āĻšā§ŸāϤ⧋ Love đŸŒŧ", "đŸĢļ💛\nāϤ⧋āĻŽāĻžāϕ⧇ āĻĒāĻžāĻ“ā§ŸāĻžāϰ āĻĻāĻžāĻŦāĻŋ āύ⧇āχ,\nāĻļ⧁āϧ⧁ āĻŽāύ⧇ āĻŽāύ⧇ āĻāĻ•āϟ⧁ āĻ­āĻžāϞ⧋āĻŦāĻžāϏāĻŋ 💛", "đŸŒŧ🙂\nāĻāĻ•āϟāĻž āĻšāĻžāϏāĻŋ, āĻāĻ•āϟāĻž āύāĻžāĻŽ,\nāφāϰ āĻ…āϜāĻžāĻ¨ā§āϤ⧇āχ āĻ­āĻžāϞ⧋ āϞ⧇āϗ⧇ āϝāĻžāĻ“ā§ŸāĻž...", "💛🌸\nāϤ⧁āĻŽāĻŋ āϜāĻžāύ⧋ āύāĻž,\nāĻ•āĻŋāĻ¨ā§āϤ⧁ āϤ⧋āĻŽāĻžāϰ āĻ•āĻĨāĻž āĻŽāύ⧇ āĻĒ⧜āϞ⧇āχ\nāĻĻāĻŋāύāϟāĻž āϏ⧁āĻ¨ā§āĻĻāϰ āĻšā§Ÿā§‡ āϝāĻžā§Ÿ đŸĢļ", "đŸŒģ💛\nāĻāχ āĻ­āĻžāϞ⧋ āϞāĻžāĻ—āĻžāϟ⧁āϕ⧁\nāĻāĻ–āύāχ āϖ⧁āĻŦ āĻĻāĻžāĻŽā§€...\nLove 💛" ]; module.exports = { config: { name: "mylove", version: "1.0.1", author: "Banu_suna", countDown: 5, role: 0, shortDescription: { en: "Tag someone + Love banner", bn: "āύāĻžāĻŽ āĻĻāĻŋā§Ÿā§‡ āĻŸā§āϝāĻžāĻ— + āϞāĻžāĻ­ āĻŦā§āϝāĻžāύāĻžāϰ" }, longDescription: { en: "Find a member by name, tag them and generate a romantic love banner", bn: "āύāĻžāĻŽ āĻĻāĻŋā§Ÿā§‡ āĻŽā§‡āĻŽā§āĻŦāĻžāϰ āϖ⧁āρāĻœā§‡ āĻŸā§āϝāĻžāĻ— āĻ•āϰ⧇ āϞāĻžāĻ­ āĻŦā§āϝāĻžāύāĻžāϰ āĻŦāĻžāύāĻžā§Ÿ" }, category: "banner", guide: { en: "{pn} \nExample: {pn} fahima chan", bn: "{pn} <āύāĻžāĻŽ>\nāωāĻĻāĻžāĻšāϰāĻŖ: {pn} fahima chan" } }, langs: { en: { missing: "⚠ Please enter a name.\nExample: .mylove fahima chan", notFound: "✗ No member found matching \"%1\"", cannotTagSelf: "✗ You cannot use this command on yourself.", multiple: "⚠ Multiple members found:\n%1\nPlease be more specific." }, bn: { missing: "⚠ āύāĻžāĻŽ āϞāĻŋāϖ⧁āύāĨ¤\nāωāĻĻāĻžāĻšāϰāĻŖ: .mylove fahima chan", notFound: "✗ \"%1\" āύāĻžāĻŽā§‡ āϕ⧋āύ⧋ āĻŽā§‡āĻŽā§āĻŦāĻžāϰ āĻĒāĻžāĻ“ā§ŸāĻž āϝāĻžā§ŸāύāĻŋ", cannotTagSelf: "✗ āύāĻŋāĻœā§‡āϰ āωāĻĒāϰ āĻāχ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻž āϝāĻžāĻŦ⧇ āύāĻžāĨ¤", multiple: "⚠ āĻāĻ•āĻžāϧāĻŋāĻ• āĻŽā§‡āĻŽā§āĻŦāĻžāϰ āĻĒāĻžāĻ“ā§ŸāĻž āϗ⧇āϛ⧇:\n%1\nāφāϰ⧇āĻ•āϟ⧁ āĻ¸ā§āĻĒ⧇āϏāĻŋāĻĢāĻŋāĻ• āύāĻžāĻŽ āĻĻāĻŋāύāĨ¤" } }, onStart: async function ({ api, event, args, message, usersData, getLang }) { const { threadID, senderID } = event; if (!args[0]) { return message.reply(getLang("missing")); } const searchQuery = args.join(" ").toLowerCase().trim(); try { // ===== Find member by name ===== const threadInfo = await api.getThreadInfo(threadID); const participantIDs = (threadInfo.participantIDs || []).filter( id => id != api.getCurrentUserID() ); if (!participantIDs.length) { return message.reply(getLang("notFound", searchQuery)); } let userInfos = {}; try { userInfos = await api.getUserInfo(participantIDs); } catch (e) {} const members = []; for (const uid of participantIDs) { let name = userInfos[uid]?.name || null; try { const dbName = await usersData.getName(uid); if (dbName) name = dbName; } catch (e) {} if (!name) continue; members.push({ id: uid, name: name, nameLower: name.toLowerCase(), firstName: name.split(" ")[0].toLowerCase() }); } // Matching priority let matched = members.filter(m => m.nameLower === searchQuery); if (matched.length === 0) { matched = members.filter(m => m.firstName === searchQuery); } if (matched.length === 0) { matched = members.filter(m => m.nameLower.startsWith(searchQuery)); } if (matched.length === 0) { matched = members.filter(m => m.nameLower.includes(searchQuery)); } if (matched.length === 0) { return message.reply(getLang("notFound", searchQuery)); } if (matched.length > 1) { const list = matched.map((m, i) => (i + 1) + ". " + m.name).join("\n"); return message.reply(getLang("multiple", list)); } const target = matched[0]; const targetID = target.id; if (String(targetID) === String(senderID)) { return message.reply(getLang("cannotTagSelf")); } // ===== Generate Love Banner ===== const apiList = await axios.get( "https://gitlab.com/shahadat-sahu/sahu-api/-/raw/main/API.json", { timeout: 15000 } ); const AVATAR_CANVAS_API = apiList.data && apiList.data.AvatarCanvas; if (!AVATAR_CANVAS_API) { return message.reply("❌ AvatarCanvas API āĻĒāĻžāĻ“ā§ŸāĻž āϝāĻžā§ŸāύāĻŋāĨ¤"); } const res = await axios.post( AVATAR_CANVAS_API + "/api", { cmd: "crush2", senderID: senderID, targetID: targetID }, { responseType: "arraybuffer", timeout: 30000 } ); const cacheDir = path.join(__dirname, "cache"); await fs.ensureDir(cacheDir); const imgPath = path.join(cacheDir, "mylove_" + senderID + "_" + targetID + ".png"); await fs.writeFile(imgPath, Buffer.from(res.data)); const caption = LOVE_CAPTIONS[Math.floor(Math.random() * LOVE_CAPTIONS.length)]; const tagText = "@" + target.name; // āĻāĻ–āĻžāύ⧇ āĻ¸ā§āĻŸā§āϰāĻŋāĻ‚ āϝ⧋āĻ— āĻ•āϰ⧇ āĻŦāĻžāύāĻžāύ⧋ āĻšā§Ÿā§‡āϛ⧇ āϝāĻžāϤ⧇ template issue āύāĻž āĻšā§Ÿ const finalBody = tagText + "\n\n" + caption; await message.reply({ body: finalBody, mentions: [ { tag: tagText, id: targetID } ], attachment: fs.createReadStream(imgPath) }); try { await fs.unlink(imgPath); } catch (e) {} } catch (err) { console.error("mylove command error:", err && err.message ? err.message : err); return message.reply("✗ Error occurred. Please try again."); } } };