Jump to content
McKay Development

deleteChatMessages ERR: InvalidParam


Gassi

Recommended Posts

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!');
      }
    });
    // });
  });
});


 

Link to comment
Share on other sites

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 by Gassi
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...