This code is part of a bot (likely for WhatsApp...

August 22, 2025 at 08:19 PM

case 'igstalk': { if (!isLimit) return m.reply(mess.limit) if (!text) return m.reply(`✦ Masukkan username IG!\n\nContoh: ${prefix + command} Khyz`); m.reply(mess.wait) try { let res = await axios.get(`https://elrayyxml.my.id/stalker/instagram?username=${encodeURIComponent(text)}`); let data = res.data; if (!data || !data.result || !data.result.profile_info) return m.reply("❌ Data tidak ditemukan!"); let user = data.result.profile_info; let caption = ` ╭━━━❰ *INSTAGRAM STALKER* ❱━━━╮ ┃👤 Username: ${user.username || "-"} ┃📛 Full Name: ${user.full_name || "-"} ┃📝 Bio: ${user.biography || "-"} ┃👥 Followers: ${user.follower_count || "0"} ┃🔖 Following: ${user.following_count || "0"} ┃📸 Postingan: ${user.media_count || "0"} ┃✔️ Verified: ${user.is_verified ? "Yes" : "No"} ┃🔒 Private: ${user.is_private ? "Yes" : "No"} ┃🔗 Link: https://instagram.com/${user.username} ╰━━━━━━━━━━━━━━━━━━━━━━━╯ `.trim(); await naze.sendMessage(m.chat, { image: { url: user.profile_pic_url_hd || user.profile_pic_url }, caption }, { quoted: m }); setLimit(m, db) } catch (e) { console.error(e); m.reply("⚠️ Gagal mengambil data Instagram."); } } break;

This code is part of a bot (likely for WhatsApp or a similar platform) that provides an "Instagram Stalker" functionality. Here's a breakdown of what the code does:

1. Command Handling (case 'igstalk':)

  • The code is executed whenever the bot detects the command igstalk.

2. Preliminary Checks

  • if (!isLimit) return m.reply(mess.limit);
    • Checks if the user has any remaining command usage limits. If not, it returns a message (mess.limit) and exits.
  • if (!text) return m.reply(...)
    • Checks if the user provided an Instagram username (stored in the variable text). If not, it sends a reply prompting the user to provide one (with an example usage of the command).

3. Fetching Instagram Profile Data

  • Sends a "please wait" message via m.reply(mess.wait).
  • Attempts to fetch Instagram user data via an HTTP GET request to an API endpoint (https://elrayyxml.my.id/stalker/instagram).
  • If no valid data is retrieved, it sends an error message: ❌ Data tidak ditemukan! ("Data not found").

4. Processing the API Response

  • If data is successfully fetched:
    • Extracts the Instagram profile information (data.result.profile_info).
    • Prepares an output message (caption) summarizing the user's Instagram profile details:
      • Username
      • Full name
      • Bio
      • Follower count
      • Following count
      • Number of posts
      • Verification status
      • Profile privacy status
      • Profile link

5. Responding to the User

  • Sends a message back to the user with:
    • The Instagram user's profile picture (profile_pic_url_hd or profile_pic_url) as an image.
    • The formatted caption containing the profile details.

6. Error Handling

  • If an error occurs during the API request or processing, it catches the error and sends a failure message: ⚠️ Gagal mengambil data Instagram. ("Failed to fetch Instagram data").

7. Usage Limit Handling

  • Calls a function (setLimit()) to decrement the command usage limit for the user.

What It Does Overall

This command allows the bot to "stalk" an Instagram user by fetching publicly available profile information via an external API and displaying it to the user in a formatted message. It includes images, basic profile details, and handles limits, input validation, and errors gracefully.

Generate your own explanations
Download our vscode extension
Read other generated explanations

Built by @thebuilderjr
Sponsored by beam analytics
Read our terms and privacy policy
Forked from openai-quickstart-node