Created
April 2, 2025 18:25
-
-
Save KOULIKS94/2c28d582bf08355c580d9d4dd744a7be to your computer and use it in GitHub Desktop.
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 { 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