MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / handler

Function handler

plugins/pstalk.js:8–48  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

6 description: 'Lookup Pinterest user profile',
7 usage: '.pinstalk <username>',
8 async handler(sock, message, args, context) {
9 const chatId = context.chatId || message.key.remoteJid;
10 if (!args.length) {
11 return await sock.sendMessage(chatId, {
12 text: '*Please provide a Pinterest username.*\nExample: .pinstalk anti_establishment'
13 }, { quoted: message });
14 }
15 const username = args[0];
16 try {
17 const { data } = await axios.get(`https://discardapi.dpdns.org/api/stalk/pinterest`, {
18 params: { apikey: 'guru', username }
19 });
20 if (!data?.result) {
21 return await sock.sendMessage(chatId, { text: '❌ Pinterest user not found.' }, { quoted: message });
22 }
23 const result = data.result;
24 const profileImage = result.image?.large || result.image?.original || null;
25 const caption = `📌 *Pinterest Profile Info*\n\n` +
26 `👤 Full Name: ${result.full_name || 'N/A'}\n` +
27 `🆔 Username: ${result.username || 'N/A'}\n` +
28 `📝 Bio: ${result.bio || 'N/A'}\n` +
29 `📌 Boards: ${result.stats?.boards || 0}\n` +
30 `👥 Followers: ${result.stats?.followers || 0}\n` +
31 `➡ Following: ${result.stats?.following || 0}\n` +
32 `❤️ Likes: ${result.stats?.likes || 0}\n` +
33 `📌 Pins: ${result.stats?.pins || 0}\n` +
34 `💾 Saves: ${result.stats?.saves || 0}\n` +
35 `🔗 Profile URL: ${result.profile_url || 'N/A'}\n` +
36 `🌐 Website: ${result.website || 'N/A'}`;
37 if (profileImage) {
38 await sock.sendMessage(chatId, { image: { url: profileImage }, caption }, { quoted: message });
39 }
40 else {
41 await sock.sendMessage(chatId, { text: caption }, { quoted: message });
42 }
43 }
44 catch (err) {
45 console.error('Pinterest plugin error:', err);
46 await sock.sendMessage(chatId, { text: '❌ Failed to fetch Pinterest profile.' }, { quoted: message });
47 }
48 }
49};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected