Last active
March 5, 2025 13:46
-
-
Save nabeelxdd/a391e4506d3f3fe0b804b0c979f27d11 to your computer and use it in GitHub Desktop.
Get Group Members Jid. Plugin by Nabeel XD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { | |
| bot, | |
| getGids, | |
| jidToNum, | |
| isGroup, | |
| getGroupMembers, | |
| getName, | |
| } = require('../lib/') | |
| bot( | |
| { | |
| pattern: 'getjids ?(.*)', | |
| desc: 'Get group member JIDs', | |
| type: 'group', | |
| }, | |
| async (message, match) => { | |
| const groupJid = match.trim(); | |
| if (!isGroup(groupJid)) { | |
| return await message.send('*Give me group jid*'); | |
| } | |
| const groupMetadata = await message.groupMetadata(groupJid, true); | |
| if (!groupMetadata) { | |
| return await message.send('*You are not in the group*'); | |
| } | |
| const { subject: groupName, participants } = groupMetadata; | |
| const memberJids = participants.map((member) => member.id); | |
| const totalMembers = memberJids.length; | |
| if (totalMembers === 0) { | |
| return await message.send('This group has no members.'); | |
| } | |
| const chunkSize = 100; | |
| const jidChunks = []; | |
| for (let i = 0; i < totalMembers; i += chunkSize) { | |
| jidChunks.push(memberJids.slice(i, i + chunkSize)); | |
| } | |
| for (const chunk of jidChunks) { | |
| await message.send(chunk.join('\n')); | |
| } | |
| await message.send(`Total Members in Group: ${totalMembers} in ${groupName}`); | |
| } | |
| ); |
I want to mention all members in the group
I want to mention all members in the group
.tag
I want to participate to modifications of this plugin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want a bot