mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-15 19:08:17 +00:00
refactor!: move dirs outside of src/ (#2032)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { ModifyGuildChannelPositions } from "../../types/guilds/modifyGuildChannelPosition.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permission. Only channels to be modified are required. */
|
||||
export async function swapChannels(bot: Bot, guildId: bigint, channelPositions: ModifyGuildChannelPositions[]) {
|
||||
if (!channelPositions.length) {
|
||||
throw "You must provide at least one channels to be moved.";
|
||||
}
|
||||
|
||||
await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
bot.constants.endpoints.GUILD_CHANNELS(guildId),
|
||||
channelPositions.map((channelPosition) => {
|
||||
return {
|
||||
id: channelPosition.id,
|
||||
position: channelPosition.position,
|
||||
lock_positions: channelPosition.lockPositions,
|
||||
parent_id: channelPosition.parentId,
|
||||
};
|
||||
}),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user