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:
Almeida
2025-10-11 11:57:20 +01:00
committed by GitHub
parent 847fa9938d
commit dd795252d6
7 changed files with 0 additions and 9 deletions

View File

@@ -59,7 +59,6 @@
* @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
* @property {'GuildChannelOrphan'} GuildChannelOrphan
* @property {'GuildChannelUnowned'} GuildChannelUnowned
* @property {'GuildOwned'} GuildOwned
* @property {'GuildMembersTimeout'} GuildMembersTimeout
* @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
* @property {'GuildUncachedMe'} GuildUncachedMe
@@ -195,7 +194,6 @@ const keys = [
'GuildVoiceChannelResolve',
'GuildChannelOrphan',
'GuildChannelUnowned',
'GuildOwned',
'GuildMembersTimeout',
'GuildSoundboardSoundsTimeout',
'GuildUncachedMe',

View File

@@ -64,7 +64,6 @@ const Messages = {
[ErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice 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.GuildOwned]: 'Guild is owned by the client.',
[ErrorCodes.GuildMembersTimeout]: "Members 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.',

View File

@@ -1425,7 +1425,6 @@ class Guild extends AnonymousGuild {
* .catch(console.error);
*/
async leave() {
if (this.ownerId === this.client.user.id) throw new DiscordjsError(ErrorCodes.GuildOwned);
await this.client.rest.delete(Routes.userGuild(this.id));
return this;
}

View File

@@ -462,7 +462,6 @@ class GuildChannel extends BaseChannel {
* @readonly
*/
get manageable() {
if (this.client.user.id === this.guild.ownerId) return true;
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false;
@@ -485,7 +484,6 @@ class GuildChannel extends BaseChannel {
* @readonly
*/
get viewable() {
if (this.client.user.id === this.guild.ownerId) return true;
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false;
return permissions.has(PermissionFlagsBits.ViewChannel, false);

View File

@@ -357,7 +357,6 @@ class GuildMember extends Base {
get manageable() {
if (this.user.id === this.guild.ownerId) 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);
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
}

View File

@@ -582,7 +582,6 @@ class ThreadChannel extends BaseChannel {
* @readonly
*/
get viewable() {
if (this.client.user.id === this.guild.ownerId) return true;
const permissions = this.permissionsFor(this.client.user);
if (!permissions) return false;
return permissions.has(PermissionFlagsBits.ViewChannel, false);

View File

@@ -4038,7 +4038,6 @@ export enum DiscordjsErrorCodes {
GuildVoiceChannelResolve = 'GuildVoiceChannelResolve',
GuildChannelOrphan = 'GuildChannelOrphan',
GuildChannelUnowned = 'GuildChannelUnowned',
GuildOwned = 'GuildOwned',
GuildMembersTimeout = 'GuildMembersTimeout',
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
GuildUncachedMe = 'GuildUncachedMe',