|
|
const axios = require("axios"); |
|
|
const fetch = require("node-fetch"); |
|
|
const { sleep } = require('../lib/functions'); |
|
|
const { cmd, commands } = require("../command"); |
|
|
const config = require("../config"); |
|
|
|
|
|
cmd({ |
|
|
pattern: "ship", |
|
|
alias: ["match", "love"], |
|
|
desc: "Randomly pairs the command user with another group member.", |
|
|
react: "β€οΈ", |
|
|
category: "fun", |
|
|
filename: __filename |
|
|
}, async (conn, m, store, { from, isGroup, groupMetadata, reply, sender }) => { |
|
|
try { |
|
|
if (!isGroup) return reply("β This command can only be used in groups."); |
|
|
|
|
|
const specialNumber = config.DEV ? `${config.DEV}@s.whatsapp.net` : null; |
|
|
const participants = groupMetadata.participants.map(user => user.id); |
|
|
|
|
|
let randomPair; |
|
|
|
|
|
if (specialNumber && participants.includes(specialNumber) && sender !== specialNumber) { |
|
|
randomPair = specialNumber; |
|
|
} else { |
|
|
|
|
|
do { |
|
|
randomPair = participants[Math.floor(Math.random() * participants.length)]; |
|
|
} while (randomPair === sender); |
|
|
} |
|
|
|
|
|
const message = `π *Match Found!* π\nβ€οΈ @${sender.split("@")[0]} + @${randomPair.split("@")[0]}\nπ Congratulations! π`; |
|
|
|
|
|
await conn.sendMessage(from, { |
|
|
text: message, |
|
|
contextInfo: { |
|
|
mentionedJid: [sender, randomPair], |
|
|
forwardingScore: 999, |
|
|
isForwarded: true, |
|
|
forwardedNewsletterMessageInfo: { |
|
|
newsletterJid: "120363318387454868@newsletter", |
|
|
newsletterName: "πΙΞΉΜΞΉΜ πΖ π", |
|
|
serverMessageId: 143 |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
} catch (error) { |
|
|
console.error("β Error in ship command:", error); |
|
|
reply("β οΈ An error occurred while processing the command. Please try again."); |
|
|
} |
|
|
}); |
|
|
|