mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
refactor!: remove special cases for bot guild owner (#11160)
BREAKING CHANGE: The `GuildOwned` error code and message has been removed. Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -59,7 +59,6 @@
|
|||||||
* @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
|
* @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
|
||||||
* @property {'GuildChannelOrphan'} GuildChannelOrphan
|
* @property {'GuildChannelOrphan'} GuildChannelOrphan
|
||||||
* @property {'GuildChannelUnowned'} GuildChannelUnowned
|
* @property {'GuildChannelUnowned'} GuildChannelUnowned
|
||||||
* @property {'GuildOwned'} GuildOwned
|
|
||||||
* @property {'GuildMembersTimeout'} GuildMembersTimeout
|
* @property {'GuildMembersTimeout'} GuildMembersTimeout
|
||||||
* @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
|
* @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
|
||||||
* @property {'GuildUncachedMe'} GuildUncachedMe
|
* @property {'GuildUncachedMe'} GuildUncachedMe
|
||||||
@@ -195,7 +194,6 @@ const keys = [
|
|||||||
'GuildVoiceChannelResolve',
|
'GuildVoiceChannelResolve',
|
||||||
'GuildChannelOrphan',
|
'GuildChannelOrphan',
|
||||||
'GuildChannelUnowned',
|
'GuildChannelUnowned',
|
||||||
'GuildOwned',
|
|
||||||
'GuildMembersTimeout',
|
'GuildMembersTimeout',
|
||||||
'GuildSoundboardSoundsTimeout',
|
'GuildSoundboardSoundsTimeout',
|
||||||
'GuildUncachedMe',
|
'GuildUncachedMe',
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ const Messages = {
|
|||||||
[ErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice channel.',
|
[ErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice channel.',
|
||||||
[ErrorCodes.GuildChannelOrphan]: 'Could not find a parent to this guild channel.',
|
[ErrorCodes.GuildChannelOrphan]: 'Could not find a parent to this guild channel.',
|
||||||
[ErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.",
|
[ErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.",
|
||||||
[ErrorCodes.GuildOwned]: 'Guild is owned by the client.',
|
|
||||||
[ErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.",
|
[ErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.",
|
||||||
[ErrorCodes.GuildSoundboardSoundsTimeout]: "Soundboard sounds didn't arrive in time.",
|
[ErrorCodes.GuildSoundboardSoundsTimeout]: "Soundboard sounds didn't arrive in time.",
|
||||||
[ErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.',
|
[ErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.',
|
||||||
|
|||||||
@@ -1425,7 +1425,6 @@ class Guild extends AnonymousGuild {
|
|||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
async leave() {
|
async leave() {
|
||||||
if (this.ownerId === this.client.user.id) throw new DiscordjsError(ErrorCodes.GuildOwned);
|
|
||||||
await this.client.rest.delete(Routes.userGuild(this.id));
|
await this.client.rest.delete(Routes.userGuild(this.id));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -462,7 +462,6 @@ class GuildChannel extends BaseChannel {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get manageable() {
|
get manageable() {
|
||||||
if (this.client.user.id === this.guild.ownerId) return true;
|
|
||||||
const permissions = this.permissionsFor(this.client.user);
|
const permissions = this.permissionsFor(this.client.user);
|
||||||
if (!permissions) return false;
|
if (!permissions) return false;
|
||||||
|
|
||||||
@@ -485,7 +484,6 @@ class GuildChannel extends BaseChannel {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get viewable() {
|
get viewable() {
|
||||||
if (this.client.user.id === this.guild.ownerId) return true;
|
|
||||||
const permissions = this.permissionsFor(this.client.user);
|
const permissions = this.permissionsFor(this.client.user);
|
||||||
if (!permissions) return false;
|
if (!permissions) return false;
|
||||||
return permissions.has(PermissionFlagsBits.ViewChannel, false);
|
return permissions.has(PermissionFlagsBits.ViewChannel, false);
|
||||||
|
|||||||
@@ -357,7 +357,6 @@ class GuildMember extends Base {
|
|||||||
get manageable() {
|
get manageable() {
|
||||||
if (this.user.id === this.guild.ownerId) return false;
|
if (this.user.id === this.guild.ownerId) return false;
|
||||||
if (this.user.id === this.client.user.id) return false;
|
if (this.user.id === this.client.user.id) return false;
|
||||||
if (this.client.user.id === this.guild.ownerId) return true;
|
|
||||||
if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
|
||||||
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
|
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -582,7 +582,6 @@ class ThreadChannel extends BaseChannel {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get viewable() {
|
get viewable() {
|
||||||
if (this.client.user.id === this.guild.ownerId) return true;
|
|
||||||
const permissions = this.permissionsFor(this.client.user);
|
const permissions = this.permissionsFor(this.client.user);
|
||||||
if (!permissions) return false;
|
if (!permissions) return false;
|
||||||
return permissions.has(PermissionFlagsBits.ViewChannel, false);
|
return permissions.has(PermissionFlagsBits.ViewChannel, false);
|
||||||
|
|||||||
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
@@ -4038,7 +4038,6 @@ export enum DiscordjsErrorCodes {
|
|||||||
GuildVoiceChannelResolve = 'GuildVoiceChannelResolve',
|
GuildVoiceChannelResolve = 'GuildVoiceChannelResolve',
|
||||||
GuildChannelOrphan = 'GuildChannelOrphan',
|
GuildChannelOrphan = 'GuildChannelOrphan',
|
||||||
GuildChannelUnowned = 'GuildChannelUnowned',
|
GuildChannelUnowned = 'GuildChannelUnowned',
|
||||||
GuildOwned = 'GuildOwned',
|
|
||||||
GuildMembersTimeout = 'GuildMembersTimeout',
|
GuildMembersTimeout = 'GuildMembersTimeout',
|
||||||
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
|
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
|
||||||
GuildUncachedMe = 'GuildUncachedMe',
|
GuildUncachedMe = 'GuildUncachedMe',
|
||||||
|
|||||||
Reference in New Issue
Block a user