Closed sudeepaviraj closed 1 year ago
+1 - Here's my minimal code example
const venom = require('./dist/index');
venom
.create({
session: 'sessionName',
headless: false,
devtools: true
})
.then((client) => start(client))
.catch(async (err) => {
console.log('Startup error: ' + err);
});
function start(client) {
client.onAnyMessage((message) => {
console.log(message);
if (message['isGroupMsg']) {
const ids = client
.getGroupMembers(message['chatId'], 1000)
.then((ids) => {
console.log(ids);
});
}
});
}
@orkestral I know you guys probably hate my hacking but here is a possible solution. I'm not putting it through as a PR (yet) as I don't know the unexpected consequences. I commented out the call to openChatBottom() - I could not seeing it adding any value but I might be wrong. I rebuilt the dist and the getGroupParticipant() returned the participants.
I should add that this is being called during onAnyMessage() so maybe other things are being loaded at the same time outside of this.
Other people - please comment. This may or may not be a solution.
export async function getGroupParticipant(groupId, time = 1000) {
if (typeof groupId !== 'string') {
return WAPI.scope(undefined, true, null, 'Use to groupId string');
}
const chat = await WAPI.sendExist(groupId);
if (chat && chat.status != 404 && chat.id) {
// await window.Store.Cmd.openChatBottom(chat);
// await sleep(time);
const moduleGroup = await window.Store.GroupMetadata._models.filter(
(e) => e.id._serialized === groupId
);
:
:
:
@orkestral I know you guys probably hate my hacking but here is a possible solution. I'm not putting it through as a PR (yet) as I don't know the unexpected consequences. I commented out the call to openChatBottom() - I could not seeing it adding any value but I might be wrong. I rebuilt the dist and the getGroupParticipant() returned the participants.
I should add that this is being called during onAnyMessage() so maybe other things are being loaded at the same time outside of this.
Other people - please comment. This may or may not be a solution.
export async function getGroupParticipant(groupId, time = 1000) { if (typeof groupId !== 'string') { return WAPI.scope(undefined, true, null, 'Use to groupId string'); } const chat = await WAPI.sendExist(groupId); if (chat && chat.status != 404 && chat.id) { // await window.Store.Cmd.openChatBottom(chat); // await sleep(time); const moduleGroup = await window.Store.GroupMetadata._models.filter( (e) => e.id._serialized === groupId ); : : :
This worked for me. Thanks <3
This still an issue for me, I'm facing the same problem here
Error:
My code:
This still an issue for me, I'm facing the same problem here
Hi have you solved the issue?
getGroupMembers is not working
getGroupMembers function is not working when I tried to get group members
Environment
Log Output
My Code
Additional context / Screenshot