mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
refactor: use setPosition inside edit (#7263)
This commit is contained in:
@@ -7,7 +7,7 @@ const { TypeError } = require('../errors');
|
|||||||
const { Role } = require('../structures/Role');
|
const { Role } = require('../structures/Role');
|
||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
const Permissions = require('../util/Permissions');
|
const Permissions = require('../util/Permissions');
|
||||||
const { resolveColor, setPosition } = require('../util/Util');
|
const { resolveColor } = require('../util/Util');
|
||||||
|
|
||||||
let cacheWarningEmitted = false;
|
let cacheWarningEmitted = false;
|
||||||
|
|
||||||
@@ -180,19 +180,7 @@ class RoleManager extends CachedManager {
|
|||||||
if (!role) throw new TypeError('INVALID_TYPE', 'role', 'RoleResolvable');
|
if (!role) throw new TypeError('INVALID_TYPE', 'role', 'RoleResolvable');
|
||||||
|
|
||||||
if (typeof data.position === 'number') {
|
if (typeof data.position === 'number') {
|
||||||
const updatedRoles = await setPosition(
|
await role.setPosition(data.position, { reason });
|
||||||
role,
|
|
||||||
data.position,
|
|
||||||
false,
|
|
||||||
this.guild._sortedRoles(),
|
|
||||||
this.client.api.guilds(this.guild.id).roles,
|
|
||||||
reason,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.client.actions.GuildRolesPositionUpdate.handle({
|
|
||||||
guild_id: this.guild.id,
|
|
||||||
roles: updatedRoles,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let icon = data.icon;
|
let icon = data.icon;
|
||||||
|
|||||||
@@ -299,18 +299,7 @@ class GuildChannel extends Channel {
|
|||||||
data.parent &&= this.client.channels.resolveId(data.parent);
|
data.parent &&= this.client.channels.resolveId(data.parent);
|
||||||
|
|
||||||
if (typeof data.position !== 'undefined') {
|
if (typeof data.position !== 'undefined') {
|
||||||
const updatedChannels = await Util.setPosition(
|
await this.setPosition(data.position, { reason });
|
||||||
this,
|
|
||||||
data.position,
|
|
||||||
false,
|
|
||||||
this.guild._sortedChannels(this),
|
|
||||||
this.client.api.guilds(this.guild.id).channels,
|
|
||||||
reason,
|
|
||||||
);
|
|
||||||
this.client.actions.GuildChannelsPositionUpdate.handle({
|
|
||||||
guild_id: this.guild.id,
|
|
||||||
channels: updatedChannels,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let permission_overwrites;
|
let permission_overwrites;
|
||||||
|
|||||||
Reference in New Issue
Block a user