From 4f4b153360d91cf3dd235feb458fa5d5be392469 Mon Sep 17 00:00:00 2001 From: lalo Date: Fri, 25 Aug 2023 16:50:22 +0200 Subject: [PATCH] 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. --- src/classes/Message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/Message.ts b/src/classes/Message.ts index 23bcfe0a..d295212a 100644 --- a/src/classes/Message.ts +++ b/src/classes/Message.ts @@ -113,7 +113,7 @@ export class Message { * Content */ get content() { - return this.#collection.getUnderlyingObject(this.id).content; + return this.#collection.getUnderlyingObject(this.id).content ?? ""; } /**