Created
July 9, 2025 10:54
-
-
Save dipto-008/2fd764f6de4bc0342fdb4e2db82725b0 to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { loadImage, createCanvas } = require("canvas"); | |
const axios = require("axios"); | |
const fs = require("fs-extra"); | |
module.exports = { | |
config: { | |
name: "pair4", | |
aurthor:"xemon", | |
role: 0, | |
shortDescription: " ", | |
longDescription: "", | |
category: "love", | |
guide: "{pn}" | |
}, | |
onStart: async function ({ api, event, args, usersData, threadsData }) { | |
let pathImg = __dirname + "/tmp/background.png"; | |
let pathAvt1 = __dirname + "/tmp/Avtmot.png"; | |
let pathAvt2 = __dirname + "/tmp/Avthai.png"; | |
var id1 = event.senderID; | |
var name1 = await usersData.getName(id1); // Replace with function that retrieves the name of the user | |
var ThreadInfo = await api.getThreadInfo(event.threadID); | |
var all = ThreadInfo.userInfo; | |
for (let c of all) { | |
if (c.id == id1) var gender1 = c.gender; | |
} | |
const botID = api.getCurrentUserID(); | |
let ungvien = []; | |
if (gender1 == "FEMALE") { | |
for (let u of all) { | |
if (u.gender == "MALE") { | |
if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); | |
} | |
} | |
} else if (gender1 == "MALE") { | |
for (let u of all) { | |
if (u.gender == "FEMALE") { | |
if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); | |
} | |
} | |
} else { | |
for (let u of all) { | |
if (u.id !== id1 && u.id !== botID) ungvien.push(u.id); | |
} | |
} | |
var id2 = ungvien[Math.floor(Math.random() * ungvien.length)]; | |
var name2 = await usersData.getName(id2); // Replace with function that retrieves the name of the user | |
var rd1 = Math.floor(Math.random() * 100) + 1; | |
var cc = ["0", "-1", "99,99", "-99", "-100", "101", "0,01"]; | |
var rd2 = cc[Math.floor(Math.random() * cc.length)]; | |
var djtme = [`${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd2}`, `${rd1}`, `${rd1}`, `${rd1}`, `${rd1}`]; | |
var tile = djtme[Math.floor(Math.random() * djtme.length)]; | |
var background = [ | |
"https://i.postimg.cc/5tXRQ46D/background3.png", | |
]; | |
var rd = background; | |
let getAvtmot = ( | |
await axios.get(`https://graph.facebook.com/${id1}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { | |
responseType: "arraybuffer", | |
}) | |
).data; | |
fs.writeFileSync(pathAvt1, Buffer.from(getAvtmot, "utf-8")); | |
let getAvthai = ( | |
await axios.get(`https://graph.facebook.com/${id2}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`, { | |
responseType: "arraybuffer", | |
}) | |
).data; | |
fs.writeFileSync(pathAvt2, Buffer.from(getAvthai, "utf-8")); | |
let getbackground = ( | |
await axios.get(`${rd}`, { | |
responseType: "arraybuffer", | |
}) | |
).data; | |
fs.writeFileSync(pathImg, Buffer.from(getbackground, "utf-8")); | |
let baseImage = await loadImage(pathImg); | |
let baseAvt1 = await loadImage(pathAvt1); | |
let baseAvt2 = await loadImage(pathAvt2); | |
let canvas = createCanvas(baseImage.width, baseImage.height); | |
let ctx = canvas.getContext("2d"); | |
ctx.drawImage(baseImage, 0, 0, canvas.width, canvas.height); | |
ctx.drawImage(baseAvt1, 100, 150, 300, 300); | |
ctx.drawImage(baseAvt2, 900, 150, 300, 300); | |
const imageBuffer = canvas.toBuffer(); | |
fs.writeFileSync(pathImg, imageBuffer); | |
fs.removeSync(pathAvt1); | |
fs.removeSync(pathAvt2); | |
return api.sendMessage( | |
{ | |
body: `γπγCongratulations ${name1}γπγ\nγβ€οΈγLooks like your destiny brought you together with ${name2}γβ€οΈγ\nγπγYour link percentage is ${tile}%γπγ`, | |
mentions: [ | |
{ | |
tag: `${name2}`, | |
id: id2, | |
}, | |
], | |
attachment: fs.createReadStream(pathImg), | |
}, | |
event.threadID, | |
() => fs.unlinkSync(pathImg), | |
event.messageID | |
); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment