revoltchat / revolt.js

Modern Typescript library for interacting with Revolt.
https://revolt.js.org
MIT License
216 stars 54 forks source link

bug: Error deleting a message after bot sends DM to user #73

Closed ghost closed 3 months ago

ghost commented 1 year ago

What happened?

Revolt.js 7 seems to not handle deleting messages using message.delete() or channel.deleteMessages() correctly after a DM is sent.

Error message:

/home/dumpling/Documents/Code/stationbot/packages/revolt.js/lib/cjs/classes/Message.js:96
        return __classPrivateFieldGet(this, _Message_collection, "f").getUnderlyingObject(this.id).authorId;
                                                                                                  ^

TypeError: Cannot read properties of undefined (reading 'authorId')
    at get authorId [as authorId] (/home/dumpling/Documents/Code/stationbot/packages/revolt.js/lib/cjs/classes/Message.js:96:99)
    at Timeout._onTimeout (/home/dumpling/Documents/Code/stationbot/packages/base/dist/index.js:244:53)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)

Node.js v18.7.0

Code is available here

Removing message.delete()/channel.deleteMessages() seems to fix the issue.

Currently using revolt.js 7.0.0-beta.1. Built locally.

EDIT: Add version information

ghost commented 1 year ago

Issue persists in revolt.js 7.0.0-beta.4

MagnusHJensen commented 1 year ago

Can't reproduce on revolt.js 7.0.0-beta.6. (Built locally)

insertish commented 3 months ago

Assuming this was fixed.