mmm / plugins /group-setting.js
ravenbs1's picture
Upload 140 files
046b271 verified
const config = require('../config')
const { cmd, commands } = require('../command')
const { getBuffer, getGroupAdmins, getRandom, h2k, isUrl, Json, runtime, sleep, fetchJson} = require('../lib/functions')
cmd({
pattern: "join",
react: "πŸ“¬",
alias: ["joinme","f_join"],
desc: "To Join a Group from Invite link",
category: "group",
use: '.join < Group Link >',
filename: __filename
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator ,isDev, isAdmins, reply}) => {
try{
const msr = (await fetchJson('https://raw.githubusercontent.com/JawadYTX/KHAN-DATA/refs/heads/main/MSG/mreply.json')).replyMsg
if (!isCreator && !isDev && !isOwner && !isMe) return reply(msr.own_cmd)
if (!q) return reply("*Please write the Group Link πŸ–‡οΈ*")
let result = args[0].split('https://chat.whatsapp.com/')[1]
await conn.groupAcceptInvite(result)
await conn.sendMessage(from , { text: `*Successfully Joined βœ…*`}, { quoted: mek } )
} catch (e) {
await conn.sendMessage(from, { react: { text: '❌', key: mek.key } })
console.log(e)
reply(`❌ *Error Accurated !!*\n\n${e}`)
}
} )
cmd({
pattern: "tagadmins",
react: "πŸ‘‘",
alias: ["admin" ,"admin","tagadmin"],
desc: "To Tag all Admins of the Group",
category: "group",
use: '.tagadmins [message]',
filename: __filename
},
async (conn, mek, m, { from, participants, reply, isGroup, senderNumber, groupAdmins, prefix, command, args, body }) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
const botOwner = conn.user.id.split(":")[0]; // Extract bot owner's number
const senderJid = senderNumber + "@s.whatsapp.net";
// Ensure group metadata is fetched properly
let groupInfo = await conn.groupMetadata(from).catch(() => null);
if (!groupInfo) return reply("❌ Failed to fetch group information.");
let groupName = groupInfo.subject || "Unknown Group";
let admins = await getGroupAdmins(participants);
let totalAdmins = admins ? admins.length : 0;
if (totalAdmins === 0) return reply("❌ No admins found in this group.");
let emojis = ['⚑', '✨', 'πŸŽ–οΈ', 'πŸ’Ž', 'πŸ”±', 'πŸ’—', 'β€β€πŸ©Ή', 'πŸ‘»', '🌟', 'πŸͺ„', 'πŸŽ‹', 'πŸͺΌ', '🍿', 'πŸ‘€', 'πŸ‘‘', 'πŸ¦‹', 'πŸ‹', '🌻', '🌸', 'πŸ”₯', 'πŸ‰', '🍧', '🍨', '🍦', 'πŸ§ƒ', 'πŸͺ€', '🎾', 'πŸͺ‡', '🎲', '🎑', '🧸', 'πŸŽ€', '🎈', '🩡', 'β™₯️', '🚩' , 'πŸ³οΈβ€πŸŒˆ', 'πŸ”ͺ', '🎏', '🫐', 'πŸ“', 'πŸ‡', '🐍', 'πŸͺ»', 'πŸͺΈ', 'πŸ’€'];
let randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
// Proper message extraction
let message = body.slice(body.indexOf(command) + command.length).trim();
if (!message) message = "ATTENTION ADMINS"; // Default message
let teks = `*β–’ GROUP : ${groupName}*\n*β–’ ADMINS : ${totalAdmins}*\n*β–’ MESSAGE: ${message}*\n\nβ€Ž*β•­β”€β”€β”€βγ€Œ ADMINS MENTION 」❍*\n`;
for (let admin of admins) {
if (!admin) continue; // Prevent undefined errors
teks += `*β”‚${randomEmoji} ᩧ𝆺ྀི𝅥* @${admin.split('@')[0]}\n`;
}
// teks += "└──βœͺ ALI ┃ MD βœͺ──";
conn.sendMessage(from, { text: teks, mentions: admins }, { quoted: mek });
} catch (e) {
console.error("TagAdmins Error:", e);
reply(`❌ *Error Occurred !!*\n\n${e.message || e}`);
}
});
cmd({
pattern: "invite",
react: "πŸ–‡οΈ",
alias: ["grouplink","glink"],
desc: "To Get the Group Invite link",
category: "group",
use: '.invite',
filename: __filename
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator ,isDev, isAdmins, reply}) => {
try{
const msr = (await fetchJson('https://raw.githubusercontent.com/JawadYTX/KHAN-DATA/refs/heads/main/MSG/mreply.json')).replyMsg
if (!isGroup) return reply(msr.only_gp)
if (!isAdmins) { if (!isDev) return reply(msr.you_adm),{quoted:mek }}
if (!isBotAdmins) return reply(msr.give_adm)
const code = await conn.groupInviteCode(from)
await conn.sendMessage(from , { text: `*πŸ–‡οΈ Group Link*\n\nhttps://chat.whatsapp.com/${code}`}, { quoted: mek } )
} catch (e) {
await conn.sendMessage(from, { react: { text: '❌', key: mek.key } })
console.log(e)
reply(`❌ *Error Accurated !!*\n\n${e}`)
}
} )
cmd({
pattern: "revoke",
react: "πŸ–‡οΈ",
alias: ["revokegrouplink","resetglink","revokelink","f_revoke"],
desc: "To Reset the group link",
category: "group",
use: '.revoke',
filename: __filename
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator ,isDev, isAdmins, reply}) => {
try{
const msr = (await fetchJson('https://raw.githubusercontent.com/JawadYTX/KHAN-DATA/refs/heads/main/MSG/mreply.json')).replyMsg
if (!isGroup) return reply(msr.only_gp)
if (!isAdmins) { if (!isDev) return reply(msr.you_adm),{quoted:mek }}
if (!isBotAdmins) return reply(msr.give_adm)
await conn.groupRevokeInvite(from)
await conn.sendMessage(from , { text: `*Group link Reseted* β›”`}, { quoted: mek } )
} catch (e) {
await conn.sendMessage(from, { react: { text: '❌', key: mek.key } })
console.log(e)
reply(`❌ *Error Accurated !!*\n\n${e}`)
}
} )
cmd({
pattern: "promote",
react: "πŸ₯",
alias: ["addadmin"],
desc: "Promote a user to admin.",
category: "group",
filename: __filename
}, async (conn, mek, m, {
from,
quoted,
isGroup,
isAdmins,
isOwner,
participants,
isBotAdmins,
reply
}) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins && !isOwner) return reply("❌ Only group admins or the owner can use this command.");
if (!isBotAdmins) return reply("❌ I need admin privileges to promote members.");
// ➑️ Détecter le participant à promouvoir (en réponse ou mention)
let target;
if (m.quoted) {
target = m.quoted.sender;
} else if (m.mentionedJid && m.mentionedJid.length > 0) {
target = m.mentionedJid[0];
} else if (m.msg && m.msg.contextInfo && m.msg.contextInfo.mentionedJid && m.msg.contextInfo.mentionedJid.length > 0) {
target = m.msg.contextInfo.mentionedJid[0];
}
if (!target) return reply("❌ Please mention or reply to a user to promote.");
// ➑️ Vérifier si l'utilisateur est déjà admin
const isAlreadyAdmin = participants.some(p => p.id === target && p.admin !== null);
if (isAlreadyAdmin) return reply("❗ User is already an admin.");
// ➑️ Promouvoir le participant
await conn.groupParticipantsUpdate(from, [target], "promote")
.catch(err => {
console.error(`⚠️ Failed to promote ${target}:`, err);
return reply("❌ An error occurred while promoting the participant.");
});
// ➑️ Extraire le tag à partir du JID
const tag = target.split('@')[0];
reply(`*_@${tag} Promoted Successfully_*`, { mentions: [target] });
} catch (error) {
console.error('Error while executing promote:', error);
reply('❌ An error occurred while executing the command.');
}
});
cmd({
pattern: "demote",
react: "πŸ₯",
alias: ["removeadmin"],
desc: "Demote a user from admin.",
category: "group",
filename: __filename
}, async (conn, mek, m, {
from,
quoted,
isGroup,
isAdmins,
isOwner,
participants,
isBotAdmins,
reply
}) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins && !isOwner) return reply("❌ Only group admins or the owner can use this command.");
if (!isBotAdmins) return reply("❌ I need admin privileges to demote members.");
// ➑️ Détecter le participant à rétrograder (en réponse ou mention)
let target;
if (m.quoted) {
target = m.quoted.sender;
} else if (m.mentionedJid && m.mentionedJid.length > 0) {
target = m.mentionedJid[0];
} else if (m.msg && m.msg.contextInfo && m.msg.contextInfo.mentionedJid && m.msg.contextInfo.mentionedJid.length > 0) {
target = m.msg.contextInfo.mentionedJid[0];
}
if (!target) return reply("❌ Please mention or reply to a user to demote.");
// ➑️ Vérifier si l'utilisateur est bien admin
const isAdmin = participants.some(p => p.id === target && p.admin !== null);
if (!isAdmin) return reply("❗ User is not an admin.");
// ➑️ Rétrograder le participant
await conn.groupParticipantsUpdate(from, [target], "demote")
.catch(err => {
console.error(`⚠️ Failed to demote ${target}:`, err);
return reply("❌ An error occurred while demoting the participant.");
});
// ➑️ Extraire le tag à partir du JID
const tag = target.split('@')[0];
reply(`*_@${tag} Demoted Successfully_*`, { mentions: [target] });
} catch (error) {
console.error('Error while executing demote:', error);
reply('❌ An error occurred while executing the command.');
}
});
cmd({
pattern: "taggp",
react: "πŸ”Š",
alias: ["tggp","djtaggp"],
desc: "To Tag all Members for Message",
category: "group",
use: '.tag Hi',
filename: __filename
},
async(conn, mek, m,{from, l, quoted, body, isCmd, command, mentionByTag , args, q, isGroup, sender, senderNumber, botNumber2, botNumber, pushname, isMe, isOwner, groupMetadata, groupName, participants, groupAdmins, isBotAdmins, isCreator ,isDev, isAdmins, reply}) => {
try{
if ( !m.quoted ) return reply('*Please mention a message* ℹ️')
if(!q) return reply('*Please add a Group Jid* ℹ️')
//if ( q == "120363174739054837@g.us" ) { if ( !isDev ) return reply("❌ *Acai wage ! You can send Tag messages to Official Support Group*") }
let teks = `${m.quoted.msg}`
conn.sendMessage(q, { text: teks, mentions: participants.map(a => a.id) }, { quoted: mek })
} catch (e) {
await conn.sendMessage(from, { react: { text: '❌', key: mek.key } })
console.log(e)
reply(`❌ *Error Accurated !!*\n\n${e}`)
}
} )
cmd({
pattern: "gginfo",
desc: "Get group information.",
category: "group",
filename: __filename,
}, async (conn, mek, m, {
from,
isGroup,
isAdmins,
isOwner,
isBotAdmins,
reply
}) => {
try {
// Ensure the command is used in a group
if (!isGroup) return reply("*`[❌]`This command can only be used in groups.*");
// Only admins or the owner can use this command
if (!isAdmins && !isOwner) return reply("*`[❌]`Only admins and the owner can use this command.*");
// Ensure the bot has admin privileges
if (!isBotAdmins) return reply("*`[❌]`I need admin privileges to execute this command.*");
// Get group metadata
const groupMetadata = await conn.groupMetadata(from);
const groupName = groupMetadata.subject;
const memberCount = groupMetadata.participants.length;
// Get group creator
let creator = groupMetadata.owner ? `@${groupMetadata.owner.split('@')[0]}` : 'Unknown';
// Get list of admins
const groupAdmins = groupMetadata.participants
.filter(member => member.admin)
.map((admin, index) => `${index + 1}. @${admin.id.split('@')[0]}`)
.join("\n") || "No admins found";
// Get creation date (convert from timestamp)
const creationDate = groupMetadata.creation
? new Date(groupMetadata.creation * 1000).toLocaleString('en-US', {
weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit'
})
: 'Unknown';
// Format the output message
const message = `
β•­β”€β”€β”€β”€γ€Œ *GROUP INFO* 」────◆
β”‚ 🏷️ *Ι’Κ€α΄α΄œα΄˜ ɴᴀᴍᴇ:* ${groupName}
β”‚ πŸ†” *Ι’Κ€α΄α΄œα΄˜ Ιͺα΄…:* ${from}
β”‚ πŸ‘₯ *α΄›α΄α΄›α΄€ΚŸ ᴍᴇᴍʙᴇʀs:* ${memberCount}
β”‚ πŸ‘¨πŸ»β€πŸ’» *ᴄʀᴇᴀᴛᴏʀ:* ${creator}
β”‚ πŸ“… *ᴄʀᴇᴀᴛᴇᴅ ᴏɴ:* ${creationDate}
β”‚ πŸ‘‘ *ᴀᴅᴍΙͺΙ΄s:*
β”‚ ${groupAdmins}
╰────────────────────◆`;
// Send the group information with mentions
await conn.sendMessage(from, {
text: message,
mentions: groupMetadata.participants
.filter(member => member.admin)
.map(admin => admin.id)
}, { quoted: mek });
} catch (error) {
console.error("Error in ginfo command:", error);
reply("❌ An error occurred while retrieving the group information.");
}
});
cmd({
pattern: "tagall",
react: "πŸ“‘",
alias: ["gc_tagall"],
desc: "To Tag all Members",
category: "group",
use: '.tagall [message]',
filename: __filename
},
async (conn, mek, m, { from, participants, reply, isGroup, senderNumber, groupAdmins, prefix, command, args, body }) => {
try {
if (!isGroup) return reply("*πŸ“› α΄›ΚœΙͺs ᴄᴏᴍᴍᴀɴᴅ α΄„α΄€Ι΄ ᴏɴʟʏ ʙᴇ ᴜsᴇᴅ ΙͺΙ΄ Ι’Κ€α΄α΄œα΄˜s.*");
const botOwner = conn.user.id.split(":")[0]; // Extract bot owner's number
const senderJid = senderNumber + "@s.whatsapp.net";
if (!groupAdmins.includes(senderJid) && senderNumber !== botOwner) {
return reply("*πŸ“› σɴℓʏ gΚ€Οƒα΄œα΄˜ Ξ±βˆ‚ΠΌΞΉΙ΄s ΟƒΚ€ Ρ‚Π½Ρ” σωɴєʀ α΄„Ξ±Ι΄ ᴜsΡ” Ρ‚Π½ΞΉΡ• α΄„ΟƒΠΌΠΌΞ±Ι΄βˆ‚.*");
}
// Ensure group metadata is fetched properly
let groupInfo = await conn.groupMetadata(from).catch(() => null);
if (!groupInfo) return reply("❌ Failed to fetch group information.");
let groupName = groupInfo.subject || "Unknown Group";
let totalMembers = participants ? participants.length : 0;
if (totalMembers === 0) return reply("❌ No members found in this group.");
let emojis = ['⚑', '✨', 'πŸŽ–οΈ', 'πŸ’Ž', 'πŸ”±', 'πŸ’—', 'β€β€πŸ©Ή', 'πŸ‘»', '🌟', 'πŸͺ„', 'πŸŽ‹', 'πŸͺΌ', '🍿', 'πŸ‘€', 'πŸ‘‘', 'πŸ¦‹', 'πŸ‹', '🌻', '🌸', 'πŸ”₯', 'πŸ‰', '🍧', '🍨', '🍦', 'πŸ§ƒ', 'πŸͺ€', '🎾', 'πŸͺ‡', '🎲', '🎑', '🧸', 'πŸŽ€', '🎈', '🩡', 'β™₯️', '🚩' , 'πŸ³οΈβ€πŸŒˆ', 'πŸ”ͺ', '🎏', '🫐', 'πŸ“', 'πŸ‡', '🐍', 'πŸͺ»', 'πŸͺΈ', 'πŸ’€'];
let randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
// Proper message extraction
let message = body.slice(body.indexOf(command) + command.length).trim();
if (!message) message = "ATTENTION EVERYONE"; // Default message
let teks = `*β–’ GROUP : ${groupName}*\n*β–’ MEMBERS : ${totalMembers}*\n*β–’ MESSAGE : ${message}*\n\n*β•­β”ˆβ”€γ€Œ \`𓆩ုαͺ³πŒπ„ππ“πˆπŽππ’α€Ύαͺ³π“†ͺ\` γ€β”ˆβ*\n`;
for (let mem of participants) {
if (!mem.id) continue; // Prevent undefined errors
teks += `*β”‚${randomEmoji} ᩧ𝆺ྀི𝅥* @${mem.id.split('@')[0]}\n`;
}
conn.sendMessage(from, { text: teks, mentions: participants.map(a => a.id) }, { quoted: mek });
} catch (e) {
console.error("TagAll Error:", e);
reply(`❌ *Error Occurred !!*\n\n${e.message || e}`);
}
});
cmd({
pattern: "add",
alias: ["aja"],
react: "βž•",
desc: "Adds a user to the group.",
category: "group",
filename: __filename,
use: '<number>',
},
async (conn, mek, m, { from, args, q, isGroup, senderNumber, botNumber, reply }) => {
try {
if (!isGroup) return reply("*πŸ“› This command can only be used in groups.*");
// Extract bot owner's number
const botOwner = conn.user.id.split(":")[0];
// Restrict command usage to the bot owner only
if (senderNumber !== botOwner) {
return reply("*πŸ“› Only the bot owner can use this command.*");
}
// Ensure the bot is an admin
if (!isBotAdmins) return reply("*πŸ“› I need to be an admin to add users.*");
// Validate user input
if (!q || isNaN(q)) return reply("*πŸ“› Please provide a valid phone number to add.*");
const userToAdd = `${q}@s.whatsapp.net`;
// Attempt to add the user to the group
let response = await conn.groupParticipantsUpdate(from, [userToAdd], "add");
// Check if the user was successfully added
if (response[0].status === 200) {
reply(`βœ… User *${q}* has been added to the group.`);
} else {
reply("❌ Failed to add user. Make sure the number is correct and they are not already in the group.");
}
} catch (e) {
console.error("Error adding user:", e);
reply("❌ An error occurred while adding the user. Please try again.");
}
});
cmd({
pattern: "updategdesc",
alias: ["upgdesc", "gdesc"],
react: "πŸ“œ",
desc: "Change the group description.",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, args, q, reply }) => {
try {
if (!isGroup) return reply("*πŸ“› This command can only be used in groups.*");
if (!isAdmins) return reply("*❌ Only group admins can use this command.*");
if (!isBotAdmins) return reply("❌ I need to be an admin to update the group description.");
if (!q) return reply("*❌ Please provide a new group description.*");
await conn.groupUpdateDescription(from, q);
reply("*βœ… Group description has been updated.*");
} catch (e) {
console.error("Error updating group description:", e);
reply("❌ Failed to update the group description. Please try again.");
}
});
cmd({
pattern: "updategname",
alias: ["upgname", "gname"],
react: "πŸ“",
desc: "Change the group name.",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, args, q, reply }) => {
try {
if (!isGroup) return reply("*πŸ“› This command can only be used in groups.*");
if (!isAdmins) return reply("❌ Only group admins can use this command.");
if (!isBotAdmins) return reply("*πŸ“› I need to be an admin to update the group name.*");
if (!q) return reply("*⁉️ Please provide a new group name.*");
await conn.groupUpdateSubject(from, q);
reply(`βœ… Group name has been updated to: *${q}*`);
} catch (e) {
console.error("Error updating group name:", e);
reply("❌ Failed to update the group name. Please try again.");
}
});
cmd({
pattern: "lockgc",
alias: ["lock"],
react: "πŸ”’",
desc: "Lock the group (Prevents new members from joining).",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, reply }) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins) return reply("*πŸ“› Only group admins can use this command.*");
if (!isBotAdmins) return reply("*πŸ“› I need to be an admin to lock the group.*");
await conn.groupSettingUpdate(from, "locked");
reply("*βœ… Group has been locked. New members cannot join.*");
} catch (e) {
console.error("Error locking group:", e);
reply("❌ Failed to lock the group. Please try again.");
}
});
cmd({
pattern: "mute",
alias: ["groupmute"],
react: "πŸ”‡",
desc: "Mute the group (Only admins can send messages).",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, senderNumber, isAdmins, isBotAdmins, reply }) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins) return reply("*πŸ“› ᴏɴʟʏ Ι’Κ€α΄α΄œα΄˜ ᴀᴅᴍΙͺΙ΄s α΄„α΄€Ι΄ ᴜsᴇ α΄›ΚœΙͺs ᴄᴏᴍᴍᴀɴᴅ.*");
if (!isBotAdmins) return reply("*πŸ“› ɴᴇᴇᴅ ᴛᴏ ʙᴇ α΄€Ι΄ ᴀᴅᴍΙͺΙ΄ ᴛᴏ α΄œΙ΄α΄α΄œα΄›α΄‡ α΄›Κœα΄‡ Ι’Κ€α΄α΄œα΄˜*");
await conn.groupSettingUpdate(from, "announcement");
reply("*gΚ€Οƒα΄œΟ ΠΌα΄œΡ‚Ρ”βˆ‚ sα΄œα΄„α΄„Ρ”Ρ•Ρ•fα΄œβ„“β„“ΡƒπŸ”*");
} catch (e) {
console.error("Error muting group:", e);
reply("❌ Failed to mute the group. Please try again.");
}
});
cmd({
pattern: "unmute",
alias: ["groupunmute"],
react: "πŸ”Š",
desc: "Unmute the group (Everyone can send messages).",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, senderNumber, isAdmins, isBotAdmins, reply }) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins) return reply("*πŸ“› ᴏɴʟʏ Ι’Κ€α΄α΄œα΄˜ ᴀᴅᴍΙͺΙ΄s α΄„α΄€Ι΄ ᴜsᴇ α΄›ΚœΙͺs ᴄᴏᴍᴍᴀɴᴅ.*");
if (!isBotAdmins) return reply("*πŸ“› ɴᴇᴇᴅ ᴛᴏ ʙᴇ α΄€Ι΄ ᴀᴅᴍΙͺΙ΄ ᴛᴏ α΄œΙ΄α΄α΄œα΄›α΄‡ α΄›Κœα΄‡ Ι’Κ€α΄α΄œα΄˜*");
await conn.groupSettingUpdate(from, "not_announcement");
reply("*gΚ€Οƒα΄œΟ α΄œΙ΄ΠΌΟ…Ρ‚Ρ”βˆ‚ sα΄œα΄„α΄„Ρ”Ρ•Ρ•fα΄œβ„“β„“ΡƒπŸ”“*");
} catch (e) {
console.error("Error unmuting group:", e);
reply("❌ Failed to unmute the group. Please try again.");
}
});
cmd({
pattern: "unlockgc",
alias: ["unlock"],
react: "πŸ”“",
desc: "Unlock the group (Allows new members to join).",
category: "group",
filename: __filename
},
async (conn, mek, m, { from, isGroup, isAdmins, isBotAdmins, reply }) => {
try {
if (!isGroup) return reply("❌ This command can only be used in groups.");
if (!isAdmins) return reply("*πŸ“› Only group admins can use this command.*");
if (!isBotAdmins) return reply("*πŸ“› I need to be an admin to unlock the group.*");
await conn.groupSettingUpdate(from, "unlocked");
reply("βœ… Group has been unlocked. New members can now join.");
} catch (e) {
console.error("Error unlocking group:", e);
reply("❌ Failed to unlock the group. Please try again.");
}
});