Closed grossialex closed 9 months ago
Does the method not actually change the description or does it simply not update from the client side? I am assuming the former, I'll get working on it.
Hello, I am experiencing the same issue here.
This is my code:
// this line is perfectly working, I am using the returned chat const for other methods as well
const chat = await client.getChatById(groupChat.gid._serialized)
// this function is running but never returns, it also won't throw an error
await chat.setDescription(description)
I tried to resolve it myself but failed. However, I figured this in structure GroupChat.js: await this.client.pupPage.evaluate <- it's callback function does not get called for some reason.
async setDescription(description) {
const success = await this.client.pupPage.evaluate(async (chatId, description) => {
// this code is not getting executed
const chatWid = window.Store.WidFactory.createWid(chatId);
let descId = window.Store.GroupMetadata.get(chatWid).descId;
try {
await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
return true;
} catch (err) {
if(err.name === "ServerStatusCodeError") return false;
throw err;
}
}, this.id._serialized, description);
if(!success) return false;
this.groupMetadata.desc = description;
return true;
}
the method doesn't work yet, any ideia?
well if you change
await window.Store.GroupUtils.setGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
to
await window.Store.GroupUtils.setGroupDescription(chatWid, description);
it works but u can never change the description again muhahahahha so i dont know what setGroupDescription is expecting. i see its loaded but i cant find any interface description unfortunatelly
Fixed in #2295
Is there an existing issue for this?
Describe the bug
When I try to use setDescription method (https://docs.wwebjs.dev/GroupChat.html#setDescription) doesn't work as expected.
Expected behavior
Steps to Reproduce the Bug or Issue
if (msg.body.startsWith('!desc ')) { // Change the group description let chat = await msg.getChat(); if (chat.isGroup) { let newDescription = msg.body.slice(6);
chat.setDescription(newDescription); } else { msg.reply('This command can only be used in a group!'); }
Relevant Code
No response
Browser Type
Google Chrome
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
No, I am not using Multi Device
Environment
OS: Ubuntu 22.04.2 Phone OS: Android 12 whatsapp-web.js version: 1.21.0 WhatsApp Web version: 2.2322.15 node version: 20.1.0
Additional context
No response