mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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 DataResolver = require('../util/DataResolver');
|
||||
const Permissions = require('../util/Permissions');
|
||||
const { resolveColor, setPosition } = require('../util/Util');
|
||||
const { resolveColor } = require('../util/Util');
|
||||
|
||||
let cacheWarningEmitted = false;
|
||||
|
||||
@@ -180,19 +180,7 @@ class RoleManager extends CachedManager {
|
||||
if (!role) throw new TypeError('INVALID_TYPE', 'role', 'RoleResolvable');
|
||||
|
||||
if (typeof data.position === 'number') {
|
||||
const updatedRoles = await setPosition(
|
||||
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,
|
||||
});
|
||||
await role.setPosition(data.position, { reason });
|
||||
}
|
||||
|
||||
let icon = data.icon;
|
||||
|
||||
@@ -299,18 +299,7 @@ class GuildChannel extends Channel {
|
||||
data.parent &&= this.client.channels.resolveId(data.parent);
|
||||
|
||||
if (typeof data.position !== 'undefined') {
|
||||
const updatedChannels = await Util.setPosition(
|
||||
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,
|
||||
});
|
||||
await this.setPosition(data.position, { reason });
|
||||
}
|
||||
|
||||
let permission_overwrites;
|
||||
|
||||
Reference in New Issue
Block a user