diff --git a/lib/WetSock/Message.js b/lib/WetSock/Message.js index a06d7bd..b70ee03 100644 --- a/lib/WetSock/Message.js +++ b/lib/WetSock/Message.js @@ -17,7 +17,7 @@ export default class Message { this.#message = this.#data.message; } catch(err) { this.#data = undefined; - this.#message = undefined; + this.#message = rawText; } } @@ -40,4 +40,12 @@ export default class Message { get(key) { return this.#data[key]; } + + /** + * Retrieves the text content. + * @returns {string} - the text content of the socket message; + */ + text() { + return this.#data.message || ''; + } }