Closed ronaldotantra closed 10 months ago
could you help @alechkos ?
@ronaldotantra provide the code you used
module.exports = async (client, msg) => {
let content = msg.body.split(' ');
let chats = await client.getChats();
let data = content[1].split('\n');
let groupid = data[0];
data = data.slice(1, data.length);
const group = chats.find((chat) => chat.id._serialized === groupid);
let validNumber = [];
for (let i = 0; i < data.length; i++) {
if (data[i].startsWith('08')) {
data[i] = data[i].replace('08', '628');
}
validNumber.push(data[i] + '@c.us');
}
try {
let res = await group.addParticipants(validNumber, {isInviteV4Sent: true})
console.log(res);
} catch (error) {
console.log(error);
}
};
the message is like this
!invite 120xxx61@g.us
081xxxx2323
082xxx50536
08xxx9932
08xxxx68
0853xxxx86
088xxx071
@ronaldotantra update the lib to 1.22.2-alpha.3 good luck
thankyouu it works but why it takes so long ?
console.time("add");
let res = await group.addParticipants(validNumber, {isInviteV4Sent: true})
console.timeEnd("add");
add: 5:53.232 (m:ss.mmm)
@ronaldotantra
thankyouu it works but why it takes so long ?
Because of the sleep
property, you can change it as you want
Read the method description
ahh i see thankyouu
Is there an existing issue for this?
Describe the bug
got an error when trying to add member to a group
Expected behavior
not got an error and member successfully added to group
Steps to Reproduce the Bug or Issue
adding member and got this error