Gassi Posted August 10, 2020 Report Share Posted August 10, 2020 Hey there, it seems like something is wrong with method deleteChatMessages. I've tried everything. I Just receive Error: InvalidParam on deleteChatMessages err callback. client.chat.getClanChatGroupInfo('103582791467388342', (err, response) => { console.log(err); console.log(JSON.stringify(response, null, 4)); const { chat_group_id: groupId, default_chat_id: chatId } = response.chat_group_summary; client.chat.getChatMessageHistory(groupId, chatId, { maxCount: 9999 }, (err, response) => { console.log(err); // console.log(JSON.stringify(response, null, 4)); const toDelete = response.messages.filter((x) => !x.deleted) .map((x) => ({ server_timestamp: x.server_timestamp, ordinal: x.ordinal, })); const chunks = _.chunk(toDelete, 10); // chunks.forEach((chunk) => { console.log(chunks[0]); client.chat.deleteChatMessages(groupId, chatId, chunks[0], (err) => { if (err) { logger.error(err); } else { logger.info('done!'); } }); // }); }); }); Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted August 11, 2020 Report Share Posted August 11, 2020 Have you tried deleting them one by one? Quote Link to comment Share on other sites More sharing options...
Gassi Posted August 13, 2020 Author Report Share Posted August 13, 2020 (edited) You mean an Array with just one Obj? Yes I've tried it.. Also "InvalidParam" error. Example Array: [ { server_timestamp: 2020-08-13T01:21:28.000Z, ordinal: 0 } ] Nevermind.. seems like a Steam issue... getChatMessageHistory adding empty messages between and when you try to delete this invisible steam messages, you will receive that error. I just optimized the filter now: response.messages.filter((x) => !x.deleted && x.message !== '') Edited August 13, 2020 by Gassi Dr. McKay 1 Quote Link to comment Share on other sites More sharing options...
Dr. McKay Posted August 14, 2020 Report Share Posted August 14, 2020 Interesting, I wasn't aware of that behavior. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.