mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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 {'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',
|
||||
|
||||
@@ -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.',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
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',
|
||||
GuildChannelOrphan = 'GuildChannelOrphan',
|
||||
GuildChannelUnowned = 'GuildChannelUnowned',
|
||||
GuildOwned = 'GuildOwned',
|
||||
GuildMembersTimeout = 'GuildMembersTimeout',
|
||||
GuildSoundboardSoundsTimeout = 'GuildSoundboardSoundsTimeout',
|
||||
GuildUncachedMe = 'GuildUncachedMe',
|
||||
|
||||
Reference in New Issue
Block a user