(sock, message, args, context)
| 6 | description: 'Lookup TikTok user profile', |
| 7 | usage: '.ttstalk <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 TikTok username.*\nExample: .ttstalk truepakistanofficial' |
| 13 | }, { quoted: message }); |
| 14 | } |
| 15 | const username = args[0]; |
| 16 | try { |
| 17 | const { data } = await axios.get('https://discardapi.dpdns.org/api/stalk/tiktok', { |
| 18 | params: { apikey: 'guru', username } |
| 19 | }); |
| 20 | if (!data?.result?.user) { |
| 21 | return await sock.sendMessage(chatId, { text: '❌ TikTok user not found.' }, { quoted: message }); |
| 22 | } |
| 23 | const user = data.result.user; |
| 24 | const stats = data.result.statsV2 || data.result.stats; |
| 25 | const profileImage = user.avatarLarger || user.avatarMedium || user.avatarThumb; |
| 26 | const verifiedMark = user.verified ? '✅ Verified' : ''; |
| 27 | const caption = `🎵 *TikTok Profile Info*\n\n` + |
| 28 | `👤 Nickname: ${user.nickname || 'N/A'} ${verifiedMark}\n` + |
| 29 | `🆔 Username: @${user.uniqueId || 'N/A'}\n` + |
| 30 | `📝 Bio: ${user.signature || 'N/A'}\n` + |
| 31 | `🔒 Private Account: ${user.privateAccount ? 'Yes' : 'No'}\n\n` + |
| 32 | `👥 Followers: ${stats?.followerCount || 0}\n` + |
| 33 | `➡ Following: ${stats?.followingCount || 0}\n` + |
| 34 | `❤️ Likes: ${stats?.heartCount || 0}\n` + |
| 35 | `🎥 Videos: ${stats?.videoCount || 0}\n\n` + |
| 36 | `🔗 Profile URL: https://www.tiktok.com/@${user.uniqueId}`; |
| 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('TikTok plugin error:', err); |
| 46 | await sock.sendMessage(chatId, { text: '❌ Failed to fetch TikTok profile.' }, { quoted: message }); |
| 47 | } |
| 48 | } |
| 49 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected