@@ -75,7 +75,7 @@ class BaseGuildVoiceChannel extends GuildChannel {
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
|
||||
return (
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now() &&
|
||||
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() &&
|
||||
permissions.has(Permissions.FLAGS.CONNECT, false)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ const VoiceStateManager = require('../managers/VoiceStateManager');
|
||||
const {
|
||||
ChannelTypes,
|
||||
DefaultMessageNotificationLevels,
|
||||
PartialTypes,
|
||||
VerificationLevels,
|
||||
ExplicitContentFilterLevels,
|
||||
Status,
|
||||
@@ -41,6 +40,7 @@ const Util = require('../util/Util');
|
||||
let deprecationEmittedForSetChannelPositions = false;
|
||||
let deprecationEmittedForSetRolePositions = false;
|
||||
let deprecationEmittedForDeleted = false;
|
||||
let deprecationEmittedForMe = false;
|
||||
|
||||
/**
|
||||
* @type {WeakSet<Guild>}
|
||||
@@ -608,15 +608,16 @@ class Guild extends AnonymousGuild {
|
||||
/**
|
||||
* The client user as a GuildMember of this guild.
|
||||
* @type {?GuildMember}
|
||||
* @deprecated Use {@link GuildMemberManager#me} instead.
|
||||
* @readonly
|
||||
*/
|
||||
get me() {
|
||||
return (
|
||||
this.members.resolve(this.client.user.id) ??
|
||||
(this.client.options.partials.includes(PartialTypes.GUILD_MEMBER)
|
||||
? this.members._add({ user: { id: this.client.user.id } }, true)
|
||||
: null)
|
||||
);
|
||||
if (!deprecationEmittedForMe) {
|
||||
process.emitWarning('Guild#me is deprecated. Use Guild#members#me instead.', 'DeprecationWarning');
|
||||
deprecationEmittedForMe = true;
|
||||
}
|
||||
|
||||
return this.members.me;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -415,7 +415,7 @@ class GuildChannel extends Channel {
|
||||
|
||||
// This flag allows managing even if timed out
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
if (this.guild.me.communicationDisabledUntilTimestamp > Date.now()) return false;
|
||||
if (this.guild.members.me.communicationDisabledUntilTimestamp > Date.now()) return false;
|
||||
|
||||
const bitfield = VoiceBasedChannelTypes.includes(this.type)
|
||||
? Permissions.FLAGS.MANAGE_CHANNELS | Permissions.FLAGS.CONNECT
|
||||
|
||||
@@ -56,7 +56,7 @@ class GuildEmoji extends BaseGuildEmoji {
|
||||
*/
|
||||
get deletable() {
|
||||
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
|
||||
return !this.managed && this.guild.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS);
|
||||
return !this.managed && this.guild.members.me.permissions.has(Permissions.FLAGS.MANAGE_EMOJIS_AND_STICKERS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -334,7 +334,7 @@ class GuildMember extends Base {
|
||||
if (this.user.id === this.client.user.id) return false;
|
||||
if (this.client.user.id === this.guild.ownerId) return true;
|
||||
if (!this.guild.me) throw new Error('GUILD_UNCACHED_ME');
|
||||
return this.guild.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
|
||||
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +343,7 @@ class GuildMember extends Base {
|
||||
* @readonly
|
||||
*/
|
||||
get kickable() {
|
||||
return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS);
|
||||
return this.manageable && this.guild.members.me.permissions.has(Permissions.FLAGS.KICK_MEMBERS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,7 +352,7 @@ class GuildMember extends Base {
|
||||
* @readonly
|
||||
*/
|
||||
get bannable() {
|
||||
return this.manageable && this.guild.me.permissions.has(Permissions.FLAGS.BAN_MEMBERS);
|
||||
return this.manageable && this.guild.members.me.permissions.has(Permissions.FLAGS.BAN_MEMBERS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -245,7 +245,7 @@ class Invite extends Base {
|
||||
if (!guild.me) throw new Error('GUILD_UNCACHED_ME');
|
||||
return (
|
||||
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_CHANNELS, false) ||
|
||||
guild.me.permissions.has(Permissions.FLAGS.MANAGE_GUILD)
|
||||
guild.members.me.permissions.has(Permissions.FLAGS.MANAGE_GUILD)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@ class Message extends Base {
|
||||
return Boolean(
|
||||
this.author.id === this.client.user.id ||
|
||||
(permissions.has(Permissions.FLAGS.MANAGE_MESSAGES, false) &&
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now()),
|
||||
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ class Message extends Base {
|
||||
this.mentions.everyone ||
|
||||
this.mentions.repliedUser?.id === this.client.user.id ||
|
||||
this.mentions.users.has(this.client.user.id) ||
|
||||
(this.guildId && this.mentions.roles.some(r => this.guild.me._roles?.includes(r.id)))
|
||||
(this.guildId && this.mentions.roles.some(r => this.guild.members.me._roles?.includes(r.id)))
|
||||
? 1
|
||||
: 0,
|
||||
},
|
||||
|
||||
@@ -529,7 +529,7 @@ class ThreadChannel extends Channel {
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
|
||||
return (
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now() &&
|
||||
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() &&
|
||||
permissions.has(Permissions.FLAGS.MANAGE_THREADS, false)
|
||||
);
|
||||
}
|
||||
@@ -561,7 +561,7 @@ class ThreadChannel extends Channel {
|
||||
!(this.archived && this.locked && !this.manageable) &&
|
||||
(this.type !== 'GUILD_PRIVATE_THREAD' || this.joined || this.manageable) &&
|
||||
permissions.has(Permissions.FLAGS.SEND_MESSAGES_IN_THREADS, false) &&
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now()
|
||||
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
||||
if (permissions.has(Permissions.FLAGS.ADMINISTRATOR, false)) return true;
|
||||
|
||||
return (
|
||||
this.guild.me.communicationDisabledUntilTimestamp < Date.now() && permissions.has(Permissions.FLAGS.SPEAK, false)
|
||||
this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() && permissions.has(Permissions.FLAGS.SPEAK, false)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,10 +220,10 @@ class VoiceState extends Base {
|
||||
* @param {boolean} [request=true] Whether or not the client is requesting to become a speaker.
|
||||
* @example
|
||||
* // Making the client request to speak in a stage channel (raise its hand)
|
||||
* guild.me.voice.setRequestToSpeak(true);
|
||||
* guild.members.me.voice.setRequestToSpeak(true);
|
||||
* @example
|
||||
* // Making the client cancel a request to speak
|
||||
* guild.me.voice.setRequestToSpeak(false);
|
||||
* guild.members.me.voice.setRequestToSpeak(false);
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async setRequestToSpeak(request = true) {
|
||||
@@ -246,10 +246,10 @@ class VoiceState extends Base {
|
||||
* @param {boolean} [suppressed=true] Whether or not the user should be suppressed.
|
||||
* @example
|
||||
* // Making the client a speaker
|
||||
* guild.me.voice.setSuppressed(false);
|
||||
* guild.members.me.voice.setSuppressed(false);
|
||||
* @example
|
||||
* // Making the client an audience member
|
||||
* guild.me.voice.setSuppressed(true);
|
||||
* guild.members.me.voice.setSuppressed(true);
|
||||
* @example
|
||||
* // Inviting another user to speak
|
||||
* voiceState.setSuppressed(false);
|
||||
|
||||
Reference in New Issue
Block a user