Skip to content

Instantly share code, notes, and snippets.

@KOULIKS94
Created April 2, 2025 18:25
Show Gist options
  • Select an option

  • Save KOULIKS94/2c28d582bf08355c580d9d4dd744a7be to your computer and use it in GitHub Desktop.

Select an option

Save KOULIKS94/2c28d582bf08355c580d9d4dd744a7be to your computer and use it in GitHub Desktop.
const { bot, getRandom, jidToNum, db } = require('../lib/') // Added db for storing friendships
bot(
{
pattern: 'friendship ?(.*)',
fromMe: true,
desc: 'Create a long-lasting friendship with someone randomly',
type: 'fun',
},
async (message, match) => {
try {
let a = message.reply_message?.jid || message.mention?.[0];
const b = message.participant;
if (!a) {
const p = await message.groupMetadata(message.jid);
if (!p?.participants.length) return message.reply('This group is empty... No friends to be made. πŸ’”');
a = getRandom(p.participants).id;
}
// Friendship GIFs (Can be upgraded to API-based GIFs in the future)
const friendshipGIFs = [
'https://media.giphy.com/media/l0HlNaQ6gWfllcjDO/giphy.gif',
'https://media.giphy.com/media/xT0GqeSlGSRQutVnYA/giphy.gif',
'https://media.giphy.com/media/JuvQbwrP7mFfq/giphy.gif',
'https://media.giphy.com/media/3o7WIPjhfVSoLxIL20/giphy.gif',
'https://media.giphy.com/media/26AHONQ79FdWZhAI0/giphy.gif'
];
const selectedGIF = getRandom(friendshipGIFs);
// Generate a random friendship compatibility percentage
const compatibility = Math.floor(Math.random() * 101);
// Friendship Level System
let level;
if (compatibility > 90) level = "Soulmate Friends πŸ’ž";
else if (compatibility > 75) level = "Best Friends Forever 🀝";
else if (compatibility > 50) level = "Close Friends πŸ’–";
else level = "New Friends πŸŽ‰";
// Random heartfelt friendship quotes
const friendshipQuotes = [
"A true friend is a treasure that time cannot touch and distance cannot break. πŸ’–",
"Friendship isn’t about who you've known the longest, but about who stood by your side through everything. 🀝",
"Some friendships are written in the stars, destined to last forever. ✨",
"A real friend is not the one who wipes your tears but the one who stands by you to stop them. πŸ₯Ή",
"Friends are the family we choose, the light in our darkest days. πŸ’•",
];
const randomQuote = getRandom(friendshipQuotes);
// Friendship Anniversary Feature
let anniversaryMsg = '';
const storedFriendship = await db.get(`friendship_${b}_${a}`) || await db.get(`friendship_${a}_${b}`);
if (storedFriendship) {
const daysSince = Math.floor((Date.now() - storedFriendship) / (1000 * 60 * 60 * 24));
anniversaryMsg = `🎊 *Friendship Anniversary!* 🎊\nπŸŽ‰ *${daysSince} days of pure friendship!* πŸŽ‰\n\n`;
} else {
await db.set(`friendship_${b}_${a}`, Date.now());
}
const caption = `πŸŒΏπŸ’– *A Bond of True Friendship!* πŸ’–πŸŒΏ\n━━━━━━━━━━━━━━━━━━━━\nπŸ‘« *@${jidToNum(b)} and @${jidToNum(a)} have formed a special friendship!* πŸ’ž\n\nπŸ’« *Friendship Compatibility:* *${compatibility}%* πŸ’«\n✨ *Friendship Level:* *${level}* ✨\n\n${anniversaryMsg}πŸ’Œ *"${randomQuote}"*\n━━━━━━━━━━━━━━━━━━━━\n\nπŸ€— *Cherish this bond, because true friends are rare treasures in life!* πŸ’`;
return await message.sendFromUrl(selectedGIF, {
caption,
contextInfo: { mentionedJid: [b, a] },
gifPlayback: true,
});
} catch (error) {
console.error('Error in friendship command:', error);
return message.reply('Something went wrong... but true friends always find a way back. πŸ’”');
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment