← back to browse
goat command

botgc

Add user to botgc group

0
views
0
likes
0
installs

Aliases: botbox

raw source
Module.exports = {
  config: {
    name: "botgc",
    aliases: ["botbox"],
    version: "1.8",
    author: "MOHAMMAD AKASH",
    countDown: 5,
    role: 0,
    shortDescription: {
      en: "Add user to botgc group",
    },
    longDescription: {
      en: "This command adds the user to the admin botgc group, notifies the botgc group, and sends a copy to the admin inbox.",
    },
    category: "botgc",
    guide: {
      en: "To use this command, type /botgc",
    },
  },

  onStart: async function ({ api, event }) {
    const supportGroupId = "1563334832217872"; // 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 group ID
    const commandThreadID = event.threadID; // যে গ্রুপ থেকে কমান্ড দেওয়া হয়েছে
    const adminUID = "61593943674779"; // আপনার UID
    const userID = event.senderID;

    // Get user info for name + ID
    const userInfo = await api.getUserInfo(userID);
    const userName = userInfo[userID].name;

    // Fetch participants in 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 group
    const threadInfo = await api.getThreadInfo(supportGroupId);
    const participantIDs = threadInfo.participantIDs;

    if (participantIDs.includes(userID)) {
      // Already in group → only command group notification
      api.sendMessage(
        `📌 𝐀ᴅᴍɪɴ Bᴏᴛɢᴄ Gʀᴏᴜᴘ\n\n🤖 নোটিশ: ${userName}, আপনি ইতোমধ্যে 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 গ্রুপের সদস্য।\n📩 দেখতে না পেলে স্প্যাম বা মেসেজ রিকোয়েস্ট চেক করুন।`,
        commandThreadID
      );
    } else {
      // Add user
      api.addUserToGroup(userID, supportGroupId, (err) => {
        if (err) {
          // Error → command group notification
          api.sendMessage(
            `📌 𝐀ᴅᴍɪɴ 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 Gʀᴏᴜᴘ\n\n⚠️ ত্রুটি: ${userName} (ID: ${userID})-কে গ্রুপে যুক্ত করা সম্ভব হয়নি।\n❗ একাউন্ট প্রাইভেট থাকতে পারে অথবা মেসেজ রিকোয়েস্ট বন্ধ করা থাকতে পারে।`,
            commandThreadID
          );
        } else {
          // Success → command group (light notification)
          api.sendMessage(
            `✅ ${userName} (ID: ${userID})-কে সফলভাবে 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 গ্রুপে যুক্ত করা হয়েছে।`,
            commandThreadID
          );

          // Full notification message
          const notificationMessage = `📌 𝐀ᴅᴍɪɴ 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 Gʀᴏᴜᴘ\n\n👤 নতুন সদস্য যুক্ত হয়েছে: ${userName} (ID: ${userID})\n✅ অনুগ্রহ করে 𝒂𝒅𝒅𝒂 𝑾𝒊𝒕𝒉 𝑩𝒐𝙩 গ্রুপে সদস্যটিকে অনুমোদন দিন অথবা চেক করুন।`;

          // Send to support group
          api.sendMessage(notificationMessage, supportGroupId);

          // Send the same to admin inbox
          api.sendMessage(notificationMessage, adminUID);
        }
      });
    }
  },
};

View raw file