mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Fix documentations that were incorrect or missing (#1837)
* Fix docs for Guild#pruneMembers * ClientApplication returns * Guild#deleteEmoji * Guild#setRolePosition takes RoleResolvable * Client#fetchApplication returns ClientApplication not Oauth2Application * ClientDataResolver#resolveImage can return null * ClientApplication#toString small example * Guild#allowDMs now has a only for user accounts warning * ClientUserSettings#patch is private and setGuildPosition has a user account warning * Role#setPermissions can take PermissionResolvable, not just String * ChannelCreationOverwrites is for a role or a member, not for a "group" * Fix ChannelData#userlimit string being wrong "The user limit of voice the channel" :lul: * ChannelResolvable is only for Channel or Snowflake * EmojiIdentifierResolvable supports Snowflakes * UserResolvable doesn't take a guild * Make patch functions private * Remove examples * Webhoox#edit options.name defaults to the webhook name * Make VoiceConnection functions private * Am dum The whole ClientUserSettings category is only for self bots soo * Value for update functions is * * Make update functions be private * Fix GuildEditData missing Ssytemchannel property * PermissionOverwriteOptions can accept null as an option (Why did no-one document this?)
This commit is contained in:
@@ -394,7 +394,7 @@ class Client extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Obtains the OAuth Application of the bot from Discord.
|
* Obtains the OAuth Application of the bot from Discord.
|
||||||
* @param {Snowflake} [id='@me'] ID of application to fetch
|
* @param {Snowflake} [id='@me'] ID of application to fetch
|
||||||
* @returns {Promise<OAuth2Application>}
|
* @returns {Promise<ClientApplication>}
|
||||||
*/
|
*/
|
||||||
fetchApplication(id = '@me') {
|
fetchApplication(id = '@me') {
|
||||||
return this.api.oauth2.applications(id).get()
|
return this.api.oauth2.applications(id).get()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class ClientDataResolver {
|
|||||||
* * A Snowflake
|
* * A Snowflake
|
||||||
* * A Message object (resolves to the message author)
|
* * A Message object (resolves to the message author)
|
||||||
* * A GuildMember object
|
* * A GuildMember object
|
||||||
* @typedef {User|Snowflake|Message|Guild|GuildMember} UserResolvable
|
* @typedef {User|Snowflake|Message|GuildMember} UserResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +124,7 @@ class ClientDataResolver {
|
|||||||
* Data that can be resolved to give a Channel object. This can be:
|
* Data that can be resolved to give a Channel object. This can be:
|
||||||
* * A Channel object
|
* * A Channel object
|
||||||
* * A Snowflake
|
* * A Snowflake
|
||||||
* @typedef {Channel|Guild|Message|Snowflake} ChannelResolvable
|
* @typedef {Channel|Snowflake} ChannelResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,7 +171,7 @@ class ClientDataResolver {
|
|||||||
/**
|
/**
|
||||||
* Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image.
|
* Resolves a Base64Resolvable, a string, or a BufferResolvable to a Base 64 image.
|
||||||
* @param {BufferResolvable|Base64Resolvable} image The image to be resolved
|
* @param {BufferResolvable|Base64Resolvable} image The image to be resolved
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<?string>}
|
||||||
*/
|
*/
|
||||||
async resolveImage(image) {
|
async resolveImage(image) {
|
||||||
if (!image) return null;
|
if (!image) return null;
|
||||||
@@ -260,7 +260,7 @@ class ClientDataResolver {
|
|||||||
* * A custom emoji ID
|
* * A custom emoji ID
|
||||||
* * An Emoji object
|
* * An Emoji object
|
||||||
* * A ReactionEmoji object
|
* * A ReactionEmoji object
|
||||||
* @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable
|
* @typedef {string|Snowflake|Emoji|ReactionEmoji} EmojiIdentifierResolvable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Sends a request to the main gateway to join a voice channel.
|
* Sends a request to the main gateway to join a voice channel.
|
||||||
* @param {Object} [options] The options to provide
|
* @param {Object} [options] The options to provide
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
sendVoiceStateUpdate(options = {}) {
|
sendVoiceStateUpdate(options = {}) {
|
||||||
options = Util.mergeDefault({
|
options = Util.mergeDefault({
|
||||||
@@ -169,6 +170,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
* Set the token and endpoint required to connect to 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
|
||||||
|
* @private
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
setTokenAndEndpoint(token, endpoint) {
|
setTokenAndEndpoint(token, endpoint) {
|
||||||
@@ -201,6 +203,7 @@ class VoiceConnection extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Sets the Session ID for the connection.
|
* Sets the Session ID for the connection.
|
||||||
* @param {string} sessionID The voice session ID
|
* @param {string} sessionID The voice session ID
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
setSessionID(sessionID) {
|
setSessionID(sessionID) {
|
||||||
if (!sessionID) {
|
if (!sessionID) {
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class ClientApplication extends Base {
|
|||||||
/**
|
/**
|
||||||
* Reset the app's secret.
|
* Reset the app's secret.
|
||||||
* <warn>This is only available when using a user account.</warn>
|
* <warn>This is only available when using a user account.</warn>
|
||||||
* @returns {OAuth2Application}
|
* @returns {ClientApplication}
|
||||||
*/
|
*/
|
||||||
resetSecret() {
|
resetSecret() {
|
||||||
return this.client.api.oauth2.applications[this.id].reset.post()
|
return this.client.api.oauth2.applications[this.id].reset.post()
|
||||||
@@ -186,7 +186,7 @@ class ClientApplication extends Base {
|
|||||||
/**
|
/**
|
||||||
* Reset the app's bot token.
|
* Reset the app's bot token.
|
||||||
* <warn>This is only available when using a user account.</warn>
|
* <warn>This is only available when using a user account.</warn>
|
||||||
* @returns {OAuth2Application}
|
* @returns {ClientApplication}
|
||||||
*/
|
*/
|
||||||
resetToken() {
|
resetToken() {
|
||||||
return this.client.api.oauth2.applications[this.id].bot.reset.post()
|
return this.client.api.oauth2.applications[this.id].bot.reset.post()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class ClientUserChannelOverride {
|
|||||||
/**
|
/**
|
||||||
* Patch the data contained in this class with new partial data.
|
* Patch the data contained in this class with new partial data.
|
||||||
* @param {Object} data Data to patch this with
|
* @param {Object} data Data to patch this with
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
patch(data) {
|
patch(data) {
|
||||||
for (const [key, value] of Object.entries(Constants.UserChannelOverrideMap)) {
|
for (const [key, value] of Object.entries(Constants.UserChannelOverrideMap)) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class ClientUserGuildSettings {
|
|||||||
/**
|
/**
|
||||||
* Patch the data contained in this class with new partial data.
|
* Patch the data contained in this class with new partial data.
|
||||||
* @param {Object} data Data to patch this with
|
* @param {Object} data Data to patch this with
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
patch(data) {
|
patch(data) {
|
||||||
for (const [key, value] of Object.entries(Constants.UserGuildSettingsMap)) {
|
for (const [key, value] of Object.entries(Constants.UserGuildSettingsMap)) {
|
||||||
@@ -46,8 +47,9 @@ class ClientUserGuildSettings {
|
|||||||
/**
|
/**
|
||||||
* Update a specific property of the guild settings.
|
* Update a specific property of the guild settings.
|
||||||
* @param {string} name Name of property
|
* @param {string} name Name of property
|
||||||
* @param {value} value Value to patch
|
* @param {*} value Value to patch
|
||||||
* @returns {Promise<Object>}
|
* @returns {Promise<Object>}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
update(name, value) {
|
update(name, value) {
|
||||||
return this.client.api.users('@me').guilds(this.guildID).settings.patch({ data: { [name]: value } });
|
return this.client.api.users('@me').guilds(this.guildID).settings.patch({ data: { [name]: value } });
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class ClientUserSettings {
|
|||||||
/**
|
/**
|
||||||
* Patch the data contained in this class with new partial data.
|
* Patch the data contained in this class with new partial data.
|
||||||
* @param {Object} data Data to patch this with
|
* @param {Object} data Data to patch this with
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
patch(data) {
|
patch(data) {
|
||||||
for (const [key, value] of Object.entries(Constants.UserSettingsMap)) {
|
for (const [key, value] of Object.entries(Constants.UserSettingsMap)) {
|
||||||
@@ -29,14 +30,16 @@ class ClientUserSettings {
|
|||||||
/**
|
/**
|
||||||
* Update a specific property of of user settings.
|
* Update a specific property of of user settings.
|
||||||
* @param {string} name Name of property
|
* @param {string} name Name of property
|
||||||
* @param {value} value Value to patch
|
* @param {*} value Value to patch
|
||||||
* @returns {Promise<Object>}
|
* @returns {Promise<Object>}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
update(name, value) {
|
update(name, value) {
|
||||||
return this.user.client.api.users['@me'].settings.patch({ data: { [name]: value } });
|
return this.user.client.api.users['@me'].settings.patch({ data: { [name]: value } });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Sets the position of the guild in the guild listing.
|
||||||
* @param {Guild} guild The guild to move
|
* @param {Guild} guild The guild to move
|
||||||
* @param {number} position Absolute or relative position
|
* @param {number} position Absolute or relative position
|
||||||
* @param {boolean} [relative=false] Whether to position relatively or absolutely
|
* @param {boolean} [relative=false] Whether to position relatively or absolutely
|
||||||
|
|||||||
@@ -575,6 +575,7 @@ class Guild extends Base {
|
|||||||
* @property {number} [verificationLevel] The verification level of the guild
|
* @property {number} [verificationLevel] The verification level of the guild
|
||||||
* @property {number} [explicitContentFilter] The level of the explicit content filter
|
* @property {number} [explicitContentFilter] The level of the explicit content filter
|
||||||
* @property {ChannelResolvable} [afkChannel] The AFK channel of the guild
|
* @property {ChannelResolvable} [afkChannel] The AFK channel of the guild
|
||||||
|
* @property {ChannelResolvable} [systemChannel] The system channel of the guild
|
||||||
* @property {number} [afkTimeout] The AFK timeout of the guild
|
* @property {number} [afkTimeout] The AFK timeout of the guild
|
||||||
* @property {Base64Resolvable} [icon] The icon of the guild
|
* @property {Base64Resolvable} [icon] The icon of the guild
|
||||||
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
||||||
@@ -783,6 +784,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow direct messages from guild members.
|
* Allow direct messages from guild members.
|
||||||
|
* <warn>This is only available when using a user account.</warn>
|
||||||
* @param {boolean} allow Whether to allow direct messages
|
* @param {boolean} allow Whether to allow direct messages
|
||||||
* @returns {Promise<Guild>}
|
* @returns {Promise<Guild>}
|
||||||
*/
|
*/
|
||||||
@@ -844,6 +846,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prunes members from the guild based on how long they have been inactive.
|
* Prunes members from the guild based on how long they have been inactive.
|
||||||
|
* @param {Object} [options] Prune options
|
||||||
* @param {number} [options.days=7] Number of days of inactivity required to kick
|
* @param {number} [options.days=7] Number of days of inactivity required to kick
|
||||||
* @param {boolean} [options.dry=false] Get number of users that will be kicked, without actually kicking them
|
* @param {boolean} [options.dry=false] Get number of users that will be kicked, without actually kicking them
|
||||||
* @param {string} [options.reason] Reason for this prune
|
* @param {string} [options.reason] Reason for this prune
|
||||||
@@ -878,7 +881,7 @@ class Guild extends Base {
|
|||||||
* @typedef {Object} ChannelCreationOverwrites
|
* @typedef {Object} ChannelCreationOverwrites
|
||||||
* @property {PermissionResolvable[]|number} [allow] The permissions to allow
|
* @property {PermissionResolvable[]|number} [allow] The permissions to allow
|
||||||
* @property {PermissionResolvable[]|number} [deny] The permissions to deny
|
* @property {PermissionResolvable[]|number} [deny] The permissions to deny
|
||||||
* @property {RoleResolvable|UserResolvable} id ID of the group or member this overwrite is for
|
* @property {RoleResolvable|UserResolvable} id ID of the role or member this overwrite is for
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1052,7 +1055,7 @@ class Guild extends Base {
|
|||||||
* Delete an emoji.
|
* Delete an emoji.
|
||||||
* @param {Emoji|string} emoji The emoji to delete
|
* @param {Emoji|string} emoji The emoji to delete
|
||||||
* @param {string} [reason] Reason for deleting the emoji
|
* @param {string} [reason] Reason for deleting the emoji
|
||||||
* @returns {Promise}
|
* @returns {Promise<Emoji>}
|
||||||
*/
|
*/
|
||||||
deleteEmoji(emoji, reason) {
|
deleteEmoji(emoji, reason) {
|
||||||
if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji);
|
if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji);
|
||||||
@@ -1162,7 +1165,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the position of a role in this guild.
|
* Set the position of a role in this guild.
|
||||||
* @param {string|Role} role The role to edit, can be a role object or a role ID
|
* @param {RoleResolvable} role The role to edit, can be a role object or a role ID
|
||||||
* @param {number} position The new position of the role
|
* @param {number} position The new position of the role
|
||||||
* @param {boolean} [relative=false] Position Moves the role relative to its current position
|
* @param {boolean} [relative=false] Position Moves the role relative to its current position
|
||||||
* @returns {Promise<Guild>}
|
* @returns {Promise<Guild>}
|
||||||
@@ -1192,7 +1195,7 @@ class Guild extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the position of a channel in this guild.
|
* Set the position of a channel in this guild.
|
||||||
* @param {string|GuildChannel} channel The channel to edit, can be a channel object or a channel ID
|
* @param {ChannelResolvable} channel The channel to edit, can be a channel object or a channel ID
|
||||||
* @param {number} position The new position of the channel
|
* @param {number} position The new position of the channel
|
||||||
* @param {boolean} [relative=false] Position Moves the channel relative to its current position
|
* @param {boolean} [relative=false] Position Moves the channel relative to its current position
|
||||||
* @returns {Promise<Guild>}
|
* @returns {Promise<Guild>}
|
||||||
|
|||||||
@@ -127,10 +127,11 @@ class GuildChannel extends Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An object mapping permission flags to `true` (enabled) or `false` (disabled).
|
* An object mapping permission flags to `true` (enabled), `null` (default) or `false` (disabled).
|
||||||
* ```js
|
* ```js
|
||||||
* {
|
* {
|
||||||
* 'SEND_MESSAGES': true,
|
* 'SEND_MESSAGES': true,
|
||||||
|
* 'EMBED_LINKS': null,
|
||||||
* 'ATTACH_FILES': false,
|
* 'ATTACH_FILES': false,
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
@@ -217,7 +218,7 @@ class GuildChannel extends Channel {
|
|||||||
* @property {number} [position] The position of the channel
|
* @property {number} [position] The position of the channel
|
||||||
* @property {string} [topic] The topic of the text channel
|
* @property {string} [topic] The topic of the text channel
|
||||||
* @property {number} [bitrate] The bitrate of the voice channel
|
* @property {number} [bitrate] The bitrate of the voice channel
|
||||||
* @property {number} [userLimit] The user limit of voice the channel
|
* @property {number} [userLimit] The user limit of the voice channel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ class Role extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the permissions of the role.
|
* Set the permissions of the role.
|
||||||
* @param {string[]} permissions The permissions of the role
|
* @param {PermissionResolvable[]} permissions The permissions of the role
|
||||||
* @param {string} [reason] Reason for changing the role's permissions
|
* @param {string} [reason] Reason for changing the role's permissions
|
||||||
* @returns {Promise<Role>}
|
* @returns {Promise<Role>}
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ class Webhook {
|
|||||||
/**
|
/**
|
||||||
* Edit the webhook.
|
* Edit the webhook.
|
||||||
* @param {Object} options Options
|
* @param {Object} options Options
|
||||||
* @param {string} [options.name] New name for this webhook
|
* @param {string} [options.name=this.name] New name for this webhook
|
||||||
* @param {BufferResolvable} [options.avatar] New avatar for this webhook
|
* @param {BufferResolvable} [options.avatar] New avatar for this webhook
|
||||||
* @param {string} [reason] Reason for editing this webhook
|
* @param {string} [reason] Reason for editing this webhook
|
||||||
* @returns {Promise<Webhook>}
|
* @returns {Promise<Webhook>}
|
||||||
|
|||||||
Reference in New Issue
Block a user