mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
refactor: message.content always returns a string (#72)
Not to sure but this could be a simple fix for system messages having "no message content".
Everytime someone uses the `client.on("message",...)` function they have to include a check if `message.content` even exists when wanting to work with `message.content` since if you don't the program breaks every time it recieves a system message, which returns a message with undefined content. In my opinion making `message.content` always return a string is a better alternative to undefined. It would make using revolt.js more convenient for most of the developers.
This commit is contained in:
@@ -113,7 +113,7 @@ export class Message {
|
||||
* Content
|
||||
*/
|
||||
get content() {
|
||||
return this.#collection.getUnderlyingObject(this.id).content;
|
||||
return this.#collection.getUnderlyingObject(this.id).content ?? "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user