discord-html-transcripts icon indicating copy to clipboard operation
discord-html-transcripts copied to clipboard

Error while doing transcription (read properties of null)

Open MinerPL opened this issue 1 year ago • 1 comments

A copy of the message from the discord server:

When trying to perform a transcription from a messageDeleteBulk event, a problem pops up reading the author.id value (author is null?)

Error

TypeError: Cannot read properties of null (reading 'id')
    at buildProfiles (C:\Users\MinerPL\IdeaProjects\MightyBot\node_modules\discord-html-transcripts\dist\utils\buildProfiles.js:11:30)
    at renderMessages (C:\Users\MinerPL\IdeaProjects\MightyBot\node_modules\discord-html-transcripts\dist\generator\index.js:63:56)
    at generateFromMessages (C:\Users\MinerPL\IdeaProjects\MightyBot\node_modules\discord-html-transcripts\dist\index.js:43:48)
    at MightyBot.<anonymous> (C:\Users\MinerPL\IdeaProjects\MightyBot\events\logs\messageDeleteBulk.js:14:27)

Code

    const transcript = await generateFromMessages(messages.values(), channel, {
        returnType: 'attachment',
        filename: `MessageDeleteBulk-${channel.id}-${Date.now()}.html`,
        footerText: false,
        saveImages: false,
        poweredBy: true,
    });
  • Discord.JS Version: 14.10.2
  • NodeJS Version: 18.15.0
  • Discord HTML Transcripts Version: 3.1.4
  • messages.values() content - https://hastebin.com/share/ifuroyemus.yaml

MinerPL avatar May 07 '23 14:05 MinerPL

The message author is null when the message is a partial. Since its the messageDeleteBulk event, all you can do is filter out those partial messages. They sadly cannot be fetched because those messages have already been deleted.

SerenModz21 avatar Oct 02 '23 16:10 SerenModz21