Wa-automate-nodejs: Get list of groups that i'm admin of?

Created on 27 Jun 2020  Â·  13Comments  Â·  Source: open-wa/wa-automate-nodejs

Hi, is there a function that queries the groups that I am admin in, without having to loop through all the groups metadatas?

Thanks.

enhancement

All 13 comments

@tinyCoder32 I don't think there's any other way to do this but it would be quicker if it was in wapi instead of looping in the client.

I was hoping to find a way other than query 100 or 200 groups metadata members to check if the user is admin there or not.

Is there a similar feature to easily see this on WhatsApp itself?

No Mohammed, there is no way as far as I know.

@github-actions run


âš¡ Release! âš¡

(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);

//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);

//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
  })();

Changelog

🚀 Release 1.9.86 (2020-06-27)

From 1.9.86+:

//get the groups that host is admin of
await client.iAmAdmin();

//get information about a group using the invite code or link
await client.inviteInfo("https://chat.whatsapp.com/Bw26dSlAFhnIVXdEEtIJ1t")

//Join a group using the invite code or link
await client.inviteInfo("https://chat.whatsapp.com/Bw26dSlAFhnIVXdEEtIJ1t")

https://open-wa.github.io/wa-automate-nodejs/classes/client.html#iamadmin
https://open-wa.github.io/wa-automate-nodejs/classes/client.html#inviteinfo

Hi, thanks for your efforts. I think you should also add iAmSuperAdmin(). However, something is wrong there. Out of 25 groups that I am admin of, or creator, it only returned 4 groups, even with using iAmSuperAdmin.

Any suggestions?

I see now, when i click on the groups one by one (in WhatsApp Web), it querys the metadata, then your functions works and count the missing groups.

@github-actions run


âš¡ Release! âš¡

(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);

//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);

//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
  })();

Changelog

🚀 Release 1.9.91 (2020-06-28)

  • Release 1.9.91 4614cf4
  • Fix: iAmAdmin now loads all possible groups and also checks if super admin #584 65ee6fa

@tinyCoder32 try now

You're the best, Mohammed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrbarnk picture mrbarnk  Â·  5Comments

DeLuca92 picture DeLuca92  Â·  5Comments

jersonjunior picture jersonjunior  Â·  6Comments

smashah picture smashah  Â·  5Comments

vsilva472 picture vsilva472  Â·  4Comments