mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Merged master into indev-prism
This commit is contained in:
@@ -322,6 +322,14 @@ class Guild {
|
||||
return this.client.rest.methods.getGuildWebhooks(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch available voice regions
|
||||
* @returns {Collection<string, VoiceRegion>}
|
||||
*/
|
||||
fetchVoiceRegions() {
|
||||
return this.client.rest.methods.fetchVoiceRegions(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a single guild member from a user.
|
||||
* @param {UserResolvable} user The user to fetch the member for
|
||||
|
||||
@@ -540,7 +540,7 @@ class Message {
|
||||
}
|
||||
|
||||
_addReaction(emoji, user) {
|
||||
const emojiID = emoji.identifier;
|
||||
const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name);
|
||||
let reaction;
|
||||
if (this.reactions.has(emojiID)) {
|
||||
reaction = this.reactions.get(emojiID);
|
||||
@@ -549,16 +549,13 @@ class Message {
|
||||
reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id);
|
||||
this.reactions.set(emojiID, reaction);
|
||||
}
|
||||
if (!reaction.users.has(user.id)) {
|
||||
reaction.users.set(user.id, user);
|
||||
reaction.count++;
|
||||
return reaction;
|
||||
}
|
||||
return null;
|
||||
if (!reaction.users.has(user.id)) reaction.users.set(user.id, user);
|
||||
reaction.count++;
|
||||
return reaction;
|
||||
}
|
||||
|
||||
_removeReaction(emoji, user) {
|
||||
const emojiID = emoji.identifier;
|
||||
const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : encodeURIComponent(emoji.name);
|
||||
if (this.reactions.has(emojiID)) {
|
||||
const reaction = this.reactions.get(emojiID);
|
||||
if (reaction.users.has(user.id)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
||||
* <info>This class is only used for *recieved* embeds. If you wish to send one, use the {@link RichEmbed} class.</info>
|
||||
*/
|
||||
class MessageEmbed {
|
||||
constructor(message, data) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class VoiceChannel extends GuildChannel {
|
||||
* @type {boolean}
|
||||
*/
|
||||
get full() {
|
||||
return this.members.size >= this.userLimit;
|
||||
return this.userLimit > 0 && this.members.size >= this.userLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
50
src/structures/VoiceRegion.js
Normal file
50
src/structures/VoiceRegion.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Represents a Discord voice region for guilds
|
||||
*/
|
||||
class VoiceRegion {
|
||||
constructor(data) {
|
||||
/**
|
||||
* ID of the region
|
||||
* @type {string}
|
||||
*/
|
||||
this.id = data.id;
|
||||
|
||||
/**
|
||||
* Name of the region
|
||||
* @type {string}
|
||||
*/
|
||||
this.name = data.name;
|
||||
|
||||
/**
|
||||
* Whether the region is VIP-only
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.vip = data.vip;
|
||||
|
||||
/**
|
||||
* Whether the region is deprecated
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deprecated = data.deprecated;
|
||||
|
||||
/**
|
||||
* Whether the region is optimal
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.optimal = data.optimal;
|
||||
|
||||
/**
|
||||
* Whether the region is custom
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.custom = data.custom;
|
||||
|
||||
/**
|
||||
* A sample hostname for what a connection might look like
|
||||
* @type {string}
|
||||
*/
|
||||
this.sampleHostname = data.sample_hostname;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = VoiceRegion;
|
||||
Reference in New Issue
Block a user