From d6041f9fb379b6652140600a3789c30ca4e9ce56 Mon Sep 17 00:00:00 2001 From: SpaceEEC Date: Fri, 9 Jun 2017 16:27:49 +0200 Subject: [PATCH] Added Client#status and Message#type typedefs (#1571) * typedef for MessageTypes and linked Client#status to Status * should be singular * typedef for Voiceconnection#status --- src/client/Client.js | 2 +- src/client/voice/VoiceConnection.js | 2 +- src/structures/Message.js | 2 +- src/util/Constants.js | 12 ++++++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 0fd8c18e6..c9e0e09e2 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -198,7 +198,7 @@ class Client extends EventEmitter { /** * Current status of the client's connection to Discord - * @type {?number} + * @type {?Status} * @readonly */ get status() { diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index ceab3cf14..e1297ee82 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -52,7 +52,7 @@ class VoiceConnection extends EventEmitter { /** * The current status of the voice connection - * @type {number} + * @type {VoiceStatus} */ this.status = Constants.VoiceStatus.AUTHENTICATING; diff --git a/src/structures/Message.js b/src/structures/Message.js index e87c33434..6a5fdd3dc 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -40,7 +40,7 @@ class Message { /** * The type of the message - * @type {string} + * @type {MessageType} */ this.type = Constants.MessageTypes[data.type]; diff --git a/src/util/Constants.js b/src/util/Constants.js index fdcc78d7b..64d9e5963 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -329,6 +329,18 @@ exports.WSEvents = { RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE', }; +/** + * The type of a message, e.g. `DEFAULT`. Here are the available types: + * - DEFAULT + * - RECIPIENT_ADD + * - RECIPIENT_REMOVE + * - CALL + * - CHANNEL_NAME_CHANGE + * - CHANNEL_ICON_CHANGE + * - PINS_ADD + * - GUILD_MEMBER_JOIN + * @typedef {string} MessageType + */ exports.MessageTypes = [ 'DEFAULT', 'RECIPIENT_ADD',