mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Docs cleanup
This commit is contained in:
@@ -58,8 +58,8 @@ class Channel {
|
||||
* @example
|
||||
* // Delete the channel
|
||||
* channel.delete()
|
||||
* .then() // Success
|
||||
* .catch(console.error); // Log error
|
||||
* .then() // Success
|
||||
* .catch(console.error); // Log error
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteChannel(this);
|
||||
|
||||
@@ -89,8 +89,8 @@ class ClientUser extends User {
|
||||
* @example
|
||||
* // Set username
|
||||
* client.user.setUsername('discordjs')
|
||||
* .then(user => console.log(`My new username is ${user.username}`))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log(`My new username is ${user.username}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setUsername(username, password) {
|
||||
return this.client.rest.methods.updateCurrentUser({ username }, password);
|
||||
@@ -105,8 +105,8 @@ class ClientUser extends User {
|
||||
* @example
|
||||
* // Set email
|
||||
* client.user.setEmail('bob@gmail.com', 'some amazing password 123')
|
||||
* .then(user => console.log(`My new email is ${user.email}`))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log(`My new email is ${user.email}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setEmail(email, password) {
|
||||
return this.client.rest.methods.updateCurrentUser({ email }, password);
|
||||
@@ -121,8 +121,8 @@ class ClientUser extends User {
|
||||
* @example
|
||||
* // Set password
|
||||
* client.user.setPassword('some new amazing password 456', 'some amazing password 123')
|
||||
* .then(user => console.log('New password set!'))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log('New password set!'))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPassword(newPassword, oldPassword) {
|
||||
return this.client.rest.methods.updateCurrentUser({ password: newPassword }, oldPassword);
|
||||
@@ -135,8 +135,8 @@ class ClientUser extends User {
|
||||
* @example
|
||||
* // Set avatar
|
||||
* client.user.setAvatar('./avatar.png')
|
||||
* .then(user => console.log(`New avatar set!`))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log(`New avatar set!`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setAvatar(avatar) {
|
||||
if (typeof avatar === 'string' && avatar.startsWith('data:')) {
|
||||
@@ -215,10 +215,10 @@ class ClientUser extends User {
|
||||
|
||||
/**
|
||||
* A user's status. Must be one of:
|
||||
* - `online`
|
||||
* - `idle`
|
||||
* - `invisible`
|
||||
* - `dnd` (do not disturb)
|
||||
* * `online`
|
||||
* * `idle`
|
||||
* * `invisible`
|
||||
* * `dnd` (do not disturb)
|
||||
* @typedef {string} PresenceStatus
|
||||
*/
|
||||
|
||||
|
||||
@@ -114,10 +114,10 @@ class Emoji {
|
||||
* @param {EmojiEditData} data The new data for the emoji
|
||||
* @returns {Promise<Emoji>}
|
||||
* @example
|
||||
* // Edit a emoji
|
||||
* // Edit an emoji
|
||||
* emoji.edit({name: 'newemoji'})
|
||||
* .then(e => console.log(`Edited emoji ${e}`))
|
||||
* .catch(console.error);
|
||||
* .then(e => console.log(`Edited emoji ${e}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateEmoji(this, data);
|
||||
|
||||
@@ -219,7 +219,8 @@ class Guild {
|
||||
|
||||
if (!this.emojis) {
|
||||
/**
|
||||
* A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji.
|
||||
* A collection of emojis that are in this guild
|
||||
* The key is the emoji's ID, the value is the emoji
|
||||
* @type {Collection<Snowflake, Emoji>}
|
||||
*/
|
||||
this.emojis = new Collection();
|
||||
@@ -270,7 +271,7 @@ class Guild {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the acronym that shows up in place of a guild icon
|
||||
* The acronym that shows up in place of a guild icon.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -391,7 +392,8 @@ class Guild {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes.
|
||||
* Fetch a collection of invites to this guild.
|
||||
* Resolves with a collection mapping invites by their codes.
|
||||
* @returns {Promise<Collection<string, Invite>>}
|
||||
*/
|
||||
fetchInvites() {
|
||||
@@ -537,11 +539,11 @@ class Guild {
|
||||
* @example
|
||||
* // Set the guild name and region
|
||||
* guild.edit({
|
||||
* name: 'Discord Guild',
|
||||
* region: 'london',
|
||||
* name: 'Discord Guild',
|
||||
* region: 'london',
|
||||
* })
|
||||
* .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`))
|
||||
* .catch(console.error);
|
||||
* .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
const _data = {};
|
||||
@@ -737,8 +739,8 @@ class Guild {
|
||||
* @example
|
||||
* // Ban a user by ID (or with a user/guild member object)
|
||||
* guild.ban('some user ID')
|
||||
* .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log(`Banned ${user.username || user.id || user} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
ban(user, options = {}) {
|
||||
if (typeof options === 'number') {
|
||||
@@ -757,8 +759,8 @@ class Guild {
|
||||
* @example
|
||||
* // Unban a user by ID (or with a user/guild member object)
|
||||
* guild.unban('some user ID')
|
||||
* .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
* .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
unban(user) {
|
||||
return this.client.rest.methods.unbanGuildMember(this, user);
|
||||
@@ -802,8 +804,8 @@ class Guild {
|
||||
* @example
|
||||
* // Create a new text channel
|
||||
* guild.createChannel('new-general', 'text')
|
||||
* .then(channel => console.log(`Created new channel ${channel}`))
|
||||
* .catch(console.error);
|
||||
* .then(channel => console.log(`Created new channel ${channel}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
createChannel(name, type, overwrites) {
|
||||
return this.client.rest.methods.createChannel(this, name, type, overwrites);
|
||||
@@ -822,8 +824,8 @@ class Guild {
|
||||
* @returns {Promise<Guild>}
|
||||
* @example
|
||||
* guild.updateChannels([{ channel: channelID, position: newChannelIndex }])
|
||||
* .then(guild => console.log(`Updated channel positions for ${guild.id}`))
|
||||
* .catch(console.error);
|
||||
* .then(guild => console.log(`Updated channel positions for ${guild.id}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setChannelPositions(channelPositions) {
|
||||
return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);
|
||||
@@ -836,16 +838,16 @@ class Guild {
|
||||
* @example
|
||||
* // Create a new role
|
||||
* guild.createRole()
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.error);
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Create a new role with data
|
||||
* guild.createRole({
|
||||
* name: 'Super Cool People',
|
||||
* color: 'BLUE',
|
||||
* })
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.error)
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.error)
|
||||
*/
|
||||
createRole(data = {}) {
|
||||
return this.client.rest.methods.createGuildRole(this, data);
|
||||
@@ -860,13 +862,13 @@ class Guild {
|
||||
* @example
|
||||
* // Create a new emoji from a url
|
||||
* guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip')
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.error);
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // Create a new emoji from a file on your computer
|
||||
* guild.createEmoji('./memes/banana.png', 'banana')
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.error);
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
createEmoji(attachment, name, roles) {
|
||||
return new Promise(resolve => {
|
||||
@@ -897,8 +899,8 @@ class Guild {
|
||||
* @example
|
||||
* // Leave a guild
|
||||
* guild.leave()
|
||||
* .then(g => console.log(`Left the guild ${g}`))
|
||||
* .catch(console.error);
|
||||
* .then(g => console.log(`Left the guild ${g}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
leave() {
|
||||
return this.client.rest.methods.leaveGuild(this);
|
||||
@@ -910,8 +912,8 @@ class Guild {
|
||||
* @example
|
||||
* // Delete a guild
|
||||
* guild.delete()
|
||||
* .then(g => console.log(`Deleted the guild ${g}`))
|
||||
* .catch(console.error);
|
||||
* .then(g => console.log(`Deleted the guild ${g}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteGuild(this);
|
||||
|
||||
@@ -171,7 +171,7 @@ class GuildAuditLogsEntry {
|
||||
this.executor = guild.client.users.get(data.user_id);
|
||||
|
||||
/**
|
||||
* An entry in the audit log representing a specific change
|
||||
* An entry in the audit log representing a specific change.
|
||||
* @typedef {object} AuditLogChange
|
||||
* @property {string} key The property that was changed, e.g. `nick` for nickname changes
|
||||
* @property {*} [old] The old value of the change, e.g. for nicknames, the old nickname
|
||||
|
||||
@@ -142,10 +142,10 @@ class GuildChannel extends Channel {
|
||||
* @example
|
||||
* // Overwrite permissions for a message author
|
||||
* message.channel.overwritePermissions(message.author, {
|
||||
* SEND_MESSAGES: false
|
||||
* SEND_MESSAGES: false
|
||||
* })
|
||||
* .then(() => console.log('Done!'))
|
||||
* .catch(console.error);
|
||||
* .then(() => console.log('Done!'))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
overwritePermissions(userOrRole, options) {
|
||||
const payload = {
|
||||
@@ -206,8 +206,8 @@ class GuildChannel extends Channel {
|
||||
* @example
|
||||
* // Edit a channel
|
||||
* channel.edit({name: 'new-channel'})
|
||||
* .then(c => console.log(`Edited channel ${c}`))
|
||||
* .catch(console.error);
|
||||
* .then(c => console.log(`Edited channel ${c}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateChannel(this, data);
|
||||
@@ -220,8 +220,8 @@ class GuildChannel extends Channel {
|
||||
* @example
|
||||
* // Set a new channel name
|
||||
* channel.setName('not_general')
|
||||
* .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
|
||||
* .catch(console.error);
|
||||
* .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setName(name) {
|
||||
return this.edit({ name });
|
||||
@@ -235,8 +235,8 @@ class GuildChannel extends Channel {
|
||||
* @example
|
||||
* // Set a new channel position
|
||||
* channel.setPosition(2)
|
||||
* .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
|
||||
* .catch(console.error);
|
||||
* .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPosition(position, relative) {
|
||||
return this.guild.setChannelPosition(this, position, relative).then(() => this);
|
||||
@@ -249,8 +249,8 @@ class GuildChannel extends Channel {
|
||||
* @example
|
||||
* // Set a new channel topic
|
||||
* channel.setTopic('needs more rate limiting')
|
||||
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
|
||||
* .catch(console.error);
|
||||
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setTopic(topic) {
|
||||
return this.client.rest.methods.updateChannel(this, { topic });
|
||||
|
||||
@@ -481,7 +481,7 @@ class GuildMember {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ban this guild member
|
||||
* Ban this guild member.
|
||||
* @param {Object|number|string} [options] Ban options. If a number, the number of days to delete messages for, if a
|
||||
* string, the ban reason. Supplying an object allows you to do both.
|
||||
* @param {number} [options.days=0] Number of days of messages to delete
|
||||
|
||||
@@ -57,8 +57,8 @@ class Message {
|
||||
this.author = this.client.dataManager.newUser(data.author);
|
||||
|
||||
/**
|
||||
* Represents the author of the message as a guild member. Only available if the message comes from a guild
|
||||
* where the author is still a member.
|
||||
* Represents the author of the message as a guild member
|
||||
* Only available if the message comes from a guild where the author is still a member
|
||||
* @type {?GuildMember}
|
||||
*/
|
||||
this.member = this.guild ? this.guild.member(this.author) || null : null;
|
||||
@@ -209,8 +209,8 @@ class Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* The message contents with all mentions replaced by the equivalent text. If mentions cannot be resolved to a name,
|
||||
* the relevant mention in the message content will not be converted
|
||||
* The message contents with all mentions replaced by the equivalent text.
|
||||
* If mentions cannot be resolved to a name, the relevant mention in the message content will not be converted.
|
||||
* @type {string}
|
||||
* @readonly
|
||||
*/
|
||||
@@ -254,8 +254,8 @@ class Message {
|
||||
* @example
|
||||
* // Create a reaction collector
|
||||
* const collector = message.createReactionCollector(
|
||||
* (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID',
|
||||
* { time: 15000 }
|
||||
* (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID',
|
||||
* { time: 15000 }
|
||||
* );
|
||||
* collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));
|
||||
* collector.on('end', collected => console.log(`Collected ${collected.size} items`));
|
||||
@@ -271,8 +271,8 @@ class Message {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Similar to createCollector but in promise form. Resolves with a collection of reactions that pass the specified
|
||||
* filter.
|
||||
* Similar to createCollector but in promise form.
|
||||
* Resolves with a collection of reactions that pass the specified filter.
|
||||
* @param {CollectorFilter} filter The filter function to use
|
||||
* @param {AwaitReactionsOptions} [options={}] Optional options to pass to the internal collector
|
||||
* @returns {Promise<Collection<string, MessageReaction>>}
|
||||
@@ -370,8 +370,8 @@ class Message {
|
||||
* @example
|
||||
* // Update the content of a message
|
||||
* message.edit('This is my new content!')
|
||||
* .then(msg => console.log(`Updated the content of a message from ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
* .then(msg => console.log(`Updated the content of a message from ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(content, options) {
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
@@ -438,8 +438,8 @@ class Message {
|
||||
* @example
|
||||
* // Delete a message
|
||||
* message.delete()
|
||||
* .then(msg => console.log(`Deleted message from ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
* .then(msg => console.log(`Deleted message from ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete(timeout = 0) {
|
||||
if (timeout <= 0) {
|
||||
@@ -461,8 +461,8 @@ class Message {
|
||||
* @example
|
||||
* // Reply to a message
|
||||
* message.reply('Hey, I\'m a reply!')
|
||||
* .then(msg => console.log(`Sent a reply to ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
* .then(msg => console.log(`Sent a reply to ${msg.author}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
reply(content, options) {
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
|
||||
@@ -22,7 +22,8 @@ class MessageCollector extends Collector {
|
||||
super(channel.client, filter, options);
|
||||
|
||||
/**
|
||||
* @type {TextBasedChannel} channel The channel
|
||||
* The channel
|
||||
* @type {TextBasedChannel}
|
||||
*/
|
||||
this.channel = channel;
|
||||
|
||||
@@ -60,7 +61,7 @@ class MessageCollector extends Collector {
|
||||
/**
|
||||
* Handle an incoming message for possible collection.
|
||||
* @param {Message} message The message that could be collected
|
||||
* @returns {?{key: Snowflake, value: Message}} Message data to collect
|
||||
* @returns {?{key: Snowflake, value: Message}}
|
||||
* @private
|
||||
*/
|
||||
handle(message) {
|
||||
|
||||
@@ -45,7 +45,7 @@ class ReactionCollector extends Collector {
|
||||
/**
|
||||
* Handle an incoming reaction for possible collection.
|
||||
* @param {MessageReaction} reaction The reaction to possibly collect
|
||||
* @returns {?{key: Snowflake, value: MessageReaction}} Reaction data to collect
|
||||
* @returns {?{key: Snowflake, value: MessageReaction}}
|
||||
* @private
|
||||
*/
|
||||
handle(reaction) {
|
||||
|
||||
@@ -135,7 +135,7 @@ class Role {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object mapping permission names to whether or not the role enables that permission
|
||||
* Get an object mapping permission names to whether or not the role enables that permission.
|
||||
* @returns {Object<string, boolean>}
|
||||
* @example
|
||||
* // Print the serialized role permissions
|
||||
@@ -206,8 +206,8 @@ class Role {
|
||||
* @example
|
||||
* // Edit a role
|
||||
* role.edit({name: 'new role'})
|
||||
* .then(r => console.log(`Edited role ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Edited role ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateGuildRole(this, data);
|
||||
@@ -220,8 +220,8 @@ class Role {
|
||||
* @example
|
||||
* // Set the name of the role
|
||||
* role.setName('new role')
|
||||
* .then(r => console.log(`Edited name of role ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Edited name of role ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setName(name) {
|
||||
return this.edit({ name });
|
||||
@@ -234,8 +234,8 @@ class Role {
|
||||
* @example
|
||||
* // Set the color of a role
|
||||
* role.setColor('#FF0000')
|
||||
* .then(r => console.log(`Set color of role ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Set color of role ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setColor(color) {
|
||||
return this.edit({ color });
|
||||
@@ -248,8 +248,8 @@ class Role {
|
||||
* @example
|
||||
* // Set the hoist of the role
|
||||
* role.setHoist(true)
|
||||
* .then(r => console.log(`Role hoisted: ${r.hoist}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Role hoisted: ${r.hoist}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setHoist(hoist) {
|
||||
return this.edit({ hoist });
|
||||
@@ -263,8 +263,8 @@ class Role {
|
||||
* @example
|
||||
* // Set the position of the role
|
||||
* role.setPosition(1)
|
||||
* .then(r => console.log(`Role position: ${r.position}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Role position: ${r.position}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPosition(position, relative) {
|
||||
return this.guild.setRolePosition(this, position, relative).then(() => this);
|
||||
@@ -277,8 +277,8 @@ class Role {
|
||||
* @example
|
||||
* // Set the permissions of the role
|
||||
* role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS'])
|
||||
* .then(r => console.log(`Role updated ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Role updated ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPermissions(permissions) {
|
||||
return this.edit({ permissions });
|
||||
@@ -291,8 +291,8 @@ class Role {
|
||||
* @example
|
||||
* // Make the role mentionable
|
||||
* role.setMentionable(true)
|
||||
* .then(r => console.log(`Role updated ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Role updated ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setMentionable(mentionable) {
|
||||
return this.edit({ mentionable });
|
||||
@@ -304,8 +304,8 @@ class Role {
|
||||
* @example
|
||||
* // Delete a role
|
||||
* role.delete()
|
||||
* .then(r => console.log(`Deleted role ${r}`))
|
||||
* .catch(console.error);
|
||||
* .then(r => console.log(`Deleted role ${r}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteGuildRole(this);
|
||||
|
||||
@@ -63,9 +63,9 @@ class TextChannel extends GuildChannel {
|
||||
* @param {BufferResolvable|Base64Resolvable} avatar The avatar for the webhook
|
||||
* @returns {Promise<Webhook>} webhook The created webhook
|
||||
* @example
|
||||
* channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png')
|
||||
* .then(webhook => console.log(`Created webhook ${webhook}`))
|
||||
* .catch(console.error)
|
||||
* channel.createWebhook('Snek', 'https://i.imgur.com/mI8XcpG.jpg')
|
||||
* .then(webhook => console.log(`Created webhook ${webhook}`))
|
||||
* .catch(console.error)
|
||||
*/
|
||||
createWebhook(name, avatar) {
|
||||
return new Promise(resolve => {
|
||||
|
||||
@@ -13,7 +13,7 @@ class UserProfile {
|
||||
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
|
||||
* @type {Client}
|
||||
* @readonly
|
||||
|
||||
@@ -82,8 +82,8 @@ class VoiceChannel extends GuildChannel {
|
||||
* @example
|
||||
* // Set the bitrate of a voice channel
|
||||
* voiceChannel.setBitrate(48)
|
||||
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))
|
||||
* .catch(console.error);
|
||||
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setBitrate(bitrate) {
|
||||
bitrate *= 1000;
|
||||
@@ -97,8 +97,8 @@ class VoiceChannel extends GuildChannel {
|
||||
* @example
|
||||
* // Set the user limit of a voice channel
|
||||
* voiceChannel.setUserLimit(42)
|
||||
* .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))
|
||||
* .catch(console.error);
|
||||
* .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setUserLimit(userLimit) {
|
||||
return this.edit({ userLimit });
|
||||
@@ -110,8 +110,8 @@ class VoiceChannel extends GuildChannel {
|
||||
* @example
|
||||
* // Join a voice channel
|
||||
* voiceChannel.join()
|
||||
* .then(connection => console.log('Connected!'))
|
||||
* .catch(console.error);
|
||||
* .then(connection => console.log('Connected!'))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
join() {
|
||||
if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));
|
||||
|
||||
@@ -94,8 +94,8 @@ class Webhook {
|
||||
* @example
|
||||
* // Send a message
|
||||
* webhook.send('hello!')
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.error);
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
send(content, options) {
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
|
||||
@@ -69,8 +69,8 @@ class TextBasedChannel {
|
||||
* @example
|
||||
* // Send a message
|
||||
* channel.send('hello!')
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.error);
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
send(content, options) {
|
||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||
@@ -158,8 +158,8 @@ class TextBasedChannel {
|
||||
* @example
|
||||
* // Get messages
|
||||
* channel.fetchMessages({limit: 10})
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .catch(console.error);
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchMessages(options = {}) {
|
||||
return this.client.rest.methods.getChannelMessages(this, options).then(data => {
|
||||
@@ -321,8 +321,8 @@ class TextBasedChannel {
|
||||
* @example
|
||||
* // Create a message collector
|
||||
* const collector = channel.createMessageCollector(
|
||||
* m => m.content.includes('discord'),
|
||||
* { time: 15000 }
|
||||
* m => m.content.includes('discord'),
|
||||
* { time: 15000 }
|
||||
* );
|
||||
* collector.on('collect', m => console.log(`Collected ${m.content}`));
|
||||
* collector.on('end', collected => console.log(`Collected ${collected.size} items`));
|
||||
@@ -348,8 +348,8 @@ class TextBasedChannel {
|
||||
* const filter = m => m.content.startsWith('!vote');
|
||||
* // Errors: ['time'] treats ending because of the time limit as an error
|
||||
* channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] })
|
||||
* .then(collected => console.log(collected.size))
|
||||
* .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
|
||||
* .then(collected => console.log(collected.size))
|
||||
* .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));
|
||||
*/
|
||||
awaitMessages(filter, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user