Skip to content

Commit dd79525

Browse files
almeidxJiralite
andauthored
refactor!: remove special cases for bot guild owner (#11160)
BREAKING CHANGE: The `GuildOwned` error code and message has been removed. Co-authored-by: Jiralite <[email protected]>
1 parent 847fa99 commit dd79525

File tree

7 files changed

+0
-9
lines changed

7 files changed

+0
-9
lines changed

packages/discord.js/src/errors/ErrorCodes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
* @property {'GuildVoiceChannelResolve'} GuildVoiceChannelResolve
6060
* @property {'GuildChannelOrphan'} GuildChannelOrphan
6161
* @property {'GuildChannelUnowned'} GuildChannelUnowned
62-
* @property {'GuildOwned'} GuildOwned
6362
* @property {'GuildMembersTimeout'} GuildMembersTimeout
6463
* @property {'GuildSoundboardSoundsTimeout'} GuildSoundboardSoundsTimeout
6564
* @property {'GuildUncachedMe'} GuildUncachedMe
@@ -195,7 +194,6 @@ const keys = [
195194
'GuildVoiceChannelResolve',
196195
'GuildChannelOrphan',
197196
'GuildChannelUnowned',
198-
'GuildOwned',
199197
'GuildMembersTimeout',
200198
'GuildSoundboardSoundsTimeout',
201199
'GuildUncachedMe',

packages/discord.js/src/errors/Messages.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const Messages = {
6464
[ErrorCodes.GuildVoiceChannelResolve]: 'Could not resolve channel to a guild voice channel.',
6565
[ErrorCodes.GuildChannelOrphan]: 'Could not find a parent to this guild channel.',
6666
[ErrorCodes.GuildChannelUnowned]: "The fetched channel does not belong to this manager's guild.",
67-
[ErrorCodes.GuildOwned]: 'Guild is owned by the client.',
6867
[ErrorCodes.GuildMembersTimeout]: "Members didn't arrive in time.",
6968
[ErrorCodes.GuildSoundboardSoundsTimeout]: "Soundboard sounds didn't arrive in time.",
7069
[ErrorCodes.GuildUncachedMe]: 'The client user as a member of this guild is uncached.',

packages/discord.js/src/structures/Guild.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,6 @@ class Guild extends AnonymousGuild {
14251425
* .catch(console.error);
14261426
*/
14271427
async leave() {
1428-
if (this.ownerId === this.client.user.id) throw new DiscordjsError(ErrorCodes.GuildOwned);
14291428
await this.client.rest.delete(Routes.userGuild(this.id));
14301429
return this;
14311430
}

packages/discord.js/src/structures/GuildChannel.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ class GuildChannel extends BaseChannel {
462462
* @readonly
463463
*/
464464
get manageable() {
465-
if (this.client.user.id === this.guild.ownerId) return true;
466465
const permissions = this.permissionsFor(this.client.user);
467466
if (!permissions) return false;
468467

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

packages/discord.js/src/structures/GuildMember.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ class GuildMember extends Base {
357357
get manageable() {
358358
if (this.user.id === this.guild.ownerId) return false;
359359
if (this.user.id === this.client.user.id) return false;
360-
if (this.client.user.id === this.guild.ownerId) return true;
361360
if (!this.guild.members.me) throw new DiscordjsError(ErrorCodes.GuildUncachedMe);
362361
return this.guild.members.me.roles.highest.comparePositionTo(this.roles.highest) > 0;
363362
}

packages/discord.js/src/structures/ThreadChannel.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,6 @@ class ThreadChannel extends BaseChannel {
582582
* @readonly
583583
*/
584584
get viewable() {
585-
if (this.client.user.id === this.guild.ownerId) return true;
586585
const permissions = this.permissionsFor(this.client.user);
587586
if (!permissions) return false;
588587
return permissions.has(PermissionFlagsBits.ViewChannel, false);

packages/discord.js/typings/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4038,7 +4038,6 @@ export enum DiscordjsErrorCodes {
40384038
GuildVoiceChannelResolve = 'GuildVoiceChannelResolve',
40394039
GuildChannelOrphan = 'GuildChannelOrphan',
40404040
GuildChannelUnowned = 'GuildChannelUnowned',
4041-
GuildOwned = 'GuildOwned',
40424041
GuildMembersTimeout = 'GuildMembersTimeout',
40434042
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
40444043
GuildUncachedMe = 'GuildUncachedMe',

0 commit comments

Comments
 (0)