orkestral / venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
https://orkestral.io
Apache License 2.0
6.06k stars 1.19k forks source link

Facing issues with group methods like promoteParticipant, removeParticipant #2262

Closed antipr000 closed 1 year ago

antipr000 commented 1 year ago

Description

addParticipant is working fine but other group methods like promoteParticipant and removeParticipant are failing with the following error

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'removeParticipants')
    at Object.removeParticipant (<anonymous>:3299:31)
    at ExecutionContext._ExecutionContext_evaluate (/Users/sohammukherjee/Documents/whatsapp-automation/whatsapp/node_modules/puppeteer-core/src/common/ExecutionContext.ts:325:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at ExecutionContext.evaluate (/Users/sohammukherjee/Documents/whatsapp-automation/whatsapp/node_modules/puppeteer-core/src/common/ExecutionContext.ts:187:12)
    at Whatsapp.removeParticipant (/Users/sohammukherjee/Documents/whatsapp-automation/whatsapp/node_modules/venom-bot/src/api/layers/group.layer.ts:357:12)
    at /Users/sohammukherjee/Documents/whatsapp-automation/whatsapp/src/utils/venom.utils.ts:82:5

Following is the code for the same (I have used same parameters for addParticipant and it works also I have verified the account is added):

create({
    session: 'Test Session',
  }).then(async (client) => {
    console.log(client);
    // Add to group
    // await client.addParticipant('<gid>', '<pid>');

    // Promote to Admin
    // await client.promoteParticipant(
    //   '<gid>', '<pid>'
    // );

    // // Demote
    // client.demoteParticipant('<gid>', '<pid>');

    // Remove
    await client.removeParticipant(
      '<gid>', '<pid>'
    );
  });

Environment

NahuelAlcaide commented 1 year ago

I'm facing similar issues when trying to use getGroupParticipant

TypeError: client.getGroupParticipant is not a function at C:\Users\nahue\OneDrive\Escritorio\dolar\timulo.js:43:51 at EventEmitter. (C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\venom-bot\dist\api\layers\listener.layer.js:181:17) at EventEmitter.emit (node:events:511:28) at EventEmitter.emit (node:domain:489:12) at Binding. (C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\venom-bot\dist\api\layers\listener.layer.js:29:77) at Binding.run (C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\puppeteer-core\lib\cjs\puppeteer\common\Binding.js:76:123) at CDPPage._CDPPage_onBindingCalled (C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\puppeteer-core\lib\cjs\puppeteer\common\Page.js:939:70) at C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\puppeteer-core\lib\cjs\puppeteer\common\Page.js:180:100 at C:\Users\nahue\OneDrive\Escritorio\dolar\node_modules\puppeteer-core\lib\cjs\third_party\mitt\index.js:3:248 at Array.map ()

Gauravism2017 commented 1 year ago

Is there any update on this, the issue still exists.