mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Added and fixed a bunch of docs stuff (#1767)
- Fixed a common copy paste fail `the the <thing>` in various places - Apparently I can't type Resolvable correctly, Fixed that wherever applicable - Documented GroupDMChannel#nicks so that it will be displayed on the docs - GroupDMChannel#icon is nullable - Removed empty InviteOptions typdef, as its properties are now documented in GuildChannel#createInvite - MessageMentions#channels is no longer nullable - RoleData#permissions takes a PermissionResolvable or an array of them - Webhook#avatar is nullable - Added HTTPOptions typedef and added it to ClientOptions typedef - ClientUserChannelOverride#muted is for a channel and not a guild directly
This commit is contained in:
@@ -165,7 +165,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the token and endpoint required to connect to the the voice servers.
|
* Set the token and endpoint required to connect to the voice servers.
|
||||||
* @param {string} token The voice token
|
* @param {string} token The voice token
|
||||||
* @param {string} endpoint The voice endpoint
|
* @param {string} endpoint The voice endpoint
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ class ClientUser extends User {
|
|||||||
* @property {string} [accessToken] Access token to use to add a user to the Group DM
|
* @property {string} [accessToken] Access token to use to add a user to the Group DM
|
||||||
* (only available if a bot is creating the DM)
|
* (only available if a bot is creating the DM)
|
||||||
* @property {string} [nick] Permanent nickname (only available if a bot is creating the DM)
|
* @property {string} [nick] Permanent nickname (only available if a bot is creating the DM)
|
||||||
* @property {string} [id] If no user resolveable is provided and you want to assign nicknames
|
* @property {string} [id] If no user resolvable is provided and you want to assign nicknames
|
||||||
* you must provide user ids instead
|
* you must provide user ids instead
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const ClientUserChannelOverride = require('./ClientUserChannelOverride');
|
|||||||
class ClientUserGuildSettings {
|
class ClientUserGuildSettings {
|
||||||
constructor(data, client) {
|
constructor(data, client) {
|
||||||
/**
|
/**
|
||||||
* The client that created the instance of the the user
|
* The client that created the instance of the ClientUserGuildSettings
|
||||||
* @name ClientUserGuildSettings#client
|
* @name ClientUserGuildSettings#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
* @readonly
|
* @readonly
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class GroupDMChannel extends Channel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A hash of this Group DM icon
|
* A hash of this Group DM icon
|
||||||
* @type {string}
|
* @type {?string}
|
||||||
*/
|
*/
|
||||||
this.icon = data.icon;
|
this.icon = data.icon;
|
||||||
|
|
||||||
@@ -71,11 +71,13 @@ class GroupDMChannel extends Channel {
|
|||||||
*/
|
*/
|
||||||
this.applicationID = data.application_id;
|
this.applicationID = data.application_id;
|
||||||
|
|
||||||
/**
|
if (data.nicks) {
|
||||||
* Nicknames for group members
|
/**
|
||||||
* @type {?Collection<Snowflake, string>}
|
* Nicknames for group members
|
||||||
*/
|
* @type {?Collection<Snowflake, string>}
|
||||||
if (data.nicks) this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick]));
|
*/
|
||||||
|
this.nicks = new Collection(data.nicks.map(n => [n.id, n.nick]));
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.recipients) {
|
if (!this.recipients) {
|
||||||
/**
|
/**
|
||||||
@@ -181,7 +183,7 @@ class GroupDMChannel extends Channel {
|
|||||||
/**
|
/**
|
||||||
* Adds an user to this Group DM.
|
* Adds an user to this Group DM.
|
||||||
* @param {Object} options Options for this method
|
* @param {Object} options Options for this method
|
||||||
* @param {UserResolveable} options.user User to add to this Group DM
|
* @param {UserResolvable} options.user User to add to this Group DM
|
||||||
* @param {string} [options.accessToken] Access token to use to add the user to this Group DM
|
* @param {string} [options.accessToken] Access token to use to add the user to this Group DM
|
||||||
* (only available under a bot account)
|
* (only available under a bot account)
|
||||||
* @param {string} [options.nick] Permanent nickname to give the user (only available under a bot account)
|
* @param {string} [options.nick] Permanent nickname to give the user (only available under a bot account)
|
||||||
@@ -198,7 +200,7 @@ class GroupDMChannel extends Channel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an user from this Group DM.
|
* Removes an user from this Group DM.
|
||||||
* @param {UserResolveable} user User to remove
|
* @param {UserResolvable} user User to remove
|
||||||
* @returns {Promise<GroupDMChannel>}
|
* @returns {Promise<GroupDMChannel>}
|
||||||
*/
|
*/
|
||||||
removeUser(user) {
|
removeUser(user) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const { Error, TypeError } = require('../errors');
|
|||||||
class Guild {
|
class Guild {
|
||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The client that created the instance of the the guild
|
* The client that created the instance of the guild
|
||||||
* @name Guild#client
|
* @name Guild#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
* @readonly
|
* @readonly
|
||||||
@@ -912,9 +912,9 @@ class Guild {
|
|||||||
/**
|
/**
|
||||||
* Can be used to overwrite permissions when creating a channel.
|
* Can be used to overwrite permissions when creating a channel.
|
||||||
* @typedef {Object} ChannelCreationOverwrites
|
* @typedef {Object} ChannelCreationOverwrites
|
||||||
* @property {PermissionResolveable[]|number} [allow] The permissions to allow
|
* @property {PermissionResolvable[]|number} [allow] The permissions to allow
|
||||||
* @property {PermissionResolveable[]|number} [deny] The permissions to deny
|
* @property {PermissionResolvable[]|number} [deny] The permissions to deny
|
||||||
* @property {RoleResolveable|UserResolvable} id ID of the group or member this overwrite is for
|
* @property {RoleResolvable|UserResolvable} id ID of the group or member this overwrite is for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -274,15 +274,9 @@ class GuildChannel extends Channel {
|
|||||||
return this.edit({ topic }, reason);
|
return this.edit({ topic }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Options given when creating a guild channel invite.
|
|
||||||
* @typedef {Object} InviteOptions
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an invite to this guild channel.
|
* Create an invite to this guild channel.
|
||||||
* @param {InviteOptions} [options={}] Options for the invite
|
* @param {Object} [options={}] Options for the invite
|
||||||
* @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically
|
* @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically
|
||||||
* kicked after 24 hours if they have not yet received a role
|
* kicked after 24 hours if they have not yet received a role
|
||||||
* @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever)
|
* @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever)
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class MessageMentions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Any channels that were mentioned
|
* Any channels that were mentioned
|
||||||
* @type {?Collection<Snowflake, GuildChannel>}
|
* @type {Collection<Snowflake, GuildChannel>}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get channels() {
|
get channels() {
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class Role {
|
|||||||
* @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number
|
* @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number
|
||||||
* @property {boolean} [hoist] Whether or not the role should be hoisted
|
* @property {boolean} [hoist] Whether or not the role should be hoisted
|
||||||
* @property {number} [position] The position of the role
|
* @property {number} [position] The position of the role
|
||||||
* @property {string[]} [permissions] The permissions of the role
|
* @property {PermissionResolvable|PermissionResolvable[]} [permissions] The permissions of the role
|
||||||
* @property {boolean} [mentionable] Whether or not the role should be mentionable
|
* @property {boolean} [mentionable] Whether or not the role should be mentionable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const { Error } = require('../errors');
|
|||||||
class User {
|
class User {
|
||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
/**
|
/**
|
||||||
* The client that created the instance of the the user
|
* The client that created the instance of the user
|
||||||
* @name User#client
|
* @name User#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
* @readonly
|
* @readonly
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class UserProfile {
|
|||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client that created the instance of the the UserProfile.
|
* The client that created the instance of the UserProfile.
|
||||||
* @name UserProfile#client
|
* @name UserProfile#client
|
||||||
* @type {Client}
|
* @type {Client}
|
||||||
* @readonly
|
* @readonly
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Webhook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The avatar for the webhook
|
* The avatar for the webhook
|
||||||
* @type {string}
|
* @type {?string}
|
||||||
*/
|
*/
|
||||||
this.avatar = data.avatar;
|
this.avatar = data.avatar;
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class Collector extends EventEmitter {
|
|||||||
collect() {}
|
collect() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles incoming events from the the `handleDispose`. Returns null if the event should not
|
* Handles incoming events from the `handleDispose`. Returns null if the event should not
|
||||||
* be disposed, or returns the key that should be removed.
|
* be disposed, or returns the key that should be removed.
|
||||||
* @see Collector#handleDispose
|
* @see Collector#handleDispose
|
||||||
* @param {...*} args Any args the event listener emits
|
* @param {...*} args Any args the event listener emits
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const { Error, RangeError } = require('../errors');
|
|||||||
* 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the
|
* 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the
|
||||||
* most impact is typically `TYPING_START`.
|
* most impact is typically `TYPING_START`.
|
||||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||||
|
* @property {HTTPOptions} [http] HTTP options
|
||||||
*/
|
*/
|
||||||
exports.DefaultOptions = {
|
exports.DefaultOptions = {
|
||||||
apiRequestMethod: 'sequential',
|
apiRequestMethod: 'sequential',
|
||||||
@@ -63,6 +64,15 @@ exports.DefaultOptions = {
|
|||||||
},
|
},
|
||||||
version: 6,
|
version: 6,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP options
|
||||||
|
* @typedef {Object} HTTPOptions
|
||||||
|
* @property {number} [version=7] API version to use
|
||||||
|
* @property {string} [api='https://discordapp.com/api'] Base url of the API
|
||||||
|
* @property {string} [cdn='https://cdn.discordapp.com'] Base url of the CDN
|
||||||
|
* @property {string} [invite='https://discord.gg'] Base url of invites
|
||||||
|
*/
|
||||||
http: {
|
http: {
|
||||||
version: 7,
|
version: 7,
|
||||||
api: 'https://discordapp.com/api',
|
api: 'https://discordapp.com/api',
|
||||||
@@ -469,8 +479,8 @@ exports.UserSettingsMap = {
|
|||||||
|
|
||||||
explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching
|
explicit_content_filter: function explicitContentFilter(type) { // eslint-disable-line func-name-matching
|
||||||
/**
|
/**
|
||||||
* Safe direct messaging; force people's messages with images to be scanned before they are sent to you
|
* Safe direct messaging; force people's messages with images to be scanned before they are sent to you.
|
||||||
* one of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS`
|
* One of `DISABLED`, `NON_FRIENDS`, `FRIENDS_AND_NON_FRIENDS`
|
||||||
* @name ClientUserSettings#explicitContentFilter
|
* @name ClientUserSettings#explicitContentFilter
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
@@ -496,8 +506,8 @@ exports.UserSettingsMap = {
|
|||||||
exports.UserGuildSettingsMap = {
|
exports.UserGuildSettingsMap = {
|
||||||
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
|
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
|
||||||
/**
|
/**
|
||||||
* The type of message that should notify you
|
* The type of message that should notify you.
|
||||||
* one of `EVERYTHING`, `MENTIONS`, `NOTHING`
|
* One of `EVERYTHING`, `MENTIONS`, `NOTHING`
|
||||||
* @name ClientUserGuildSettings#messageNotifications
|
* @name ClientUserGuildSettings#messageNotifications
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
@@ -532,15 +542,15 @@ exports.UserGuildSettingsMap = {
|
|||||||
exports.UserChannelOverrideMap = {
|
exports.UserChannelOverrideMap = {
|
||||||
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
|
message_notifications: function messageNotifications(type) { // eslint-disable-line func-name-matching
|
||||||
/**
|
/**
|
||||||
* The type of message that should notify you
|
* The type of message that should notify you.
|
||||||
* one of `EVERYTHING`, `MENTIONS`, `NOTHING`, `INHERIT`
|
* One of `EVERYTHING`, `MENTIONS`, `NOTHING`, `INHERIT`
|
||||||
* @name ClientUserChannelOverride#messageNotifications
|
* @name ClientUserChannelOverride#messageNotifications
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
return exports.MessageNotificationTypes[type];
|
return exports.MessageNotificationTypes[type];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Whether the guild is muted or not
|
* Whether the channel is muted or not
|
||||||
* @name ClientUserChannelOverride#muted
|
* @name ClientUserChannelOverride#muted
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user