mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
@@ -1,11 +1,7 @@
|
||||
import { Bot, Channel, CreateGuildChannel, separateOverwrites } from "../deps.ts";
|
||||
|
||||
/** Create a copy of a channel */
|
||||
export async function cloneChannel(
|
||||
bot: Bot,
|
||||
channel: Channel,
|
||||
reason?: string,
|
||||
) {
|
||||
export async function cloneChannel(bot: Bot, channel: Channel, reason?: string) {
|
||||
if (!channel.guildId) {
|
||||
throw new Error(`Cannot clone a channel outside a guild`);
|
||||
}
|
||||
@@ -30,12 +26,9 @@ export async function cloneChannel(
|
||||
deny: bot.utils.calculatePermissions(BigInt(deny)),
|
||||
};
|
||||
}),
|
||||
reason,
|
||||
};
|
||||
|
||||
//Create the channel (also handles permissions)
|
||||
return await bot.helpers.createChannel(
|
||||
channel.guildId!,
|
||||
createChannelOptions,
|
||||
reason,
|
||||
);
|
||||
return await bot.helpers.createChannel(channel.guildId!, createChannelOptions);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export function createChannel(bot: BotWithCache) {
|
||||
const createChannel = bot.helpers.createChannel;
|
||||
|
||||
bot.helpers.createChannel = async function (guildId, options, reason) {
|
||||
bot.helpers.createChannel = async function (guildId, options) {
|
||||
const guild = bot.guilds.get(guildId);
|
||||
|
||||
if (guild) {
|
||||
@@ -47,6 +47,6 @@ export function createChannel(bot: BotWithCache) {
|
||||
requireBotGuildPermissions(bot, guild, requiredPerms);
|
||||
}
|
||||
|
||||
return await createChannel(guildId, options, reason);
|
||||
return await createChannel(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function editChannel(bot: BotWithCache) {
|
||||
const editChannel = bot.helpers.editChannel;
|
||||
|
||||
bot.helpers.editChannel = async function (channelId, options, reason) {
|
||||
bot.helpers.editChannel = async function (channelId, options) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
|
||||
if (channel?.guildId) {
|
||||
@@ -71,6 +71,6 @@ export function editChannel(bot: BotWithCache) {
|
||||
requireBotChannelPermissions(bot, channel, requiredPerms);
|
||||
}
|
||||
|
||||
return await editChannel(channelId, options, reason);
|
||||
return await editChannel(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,7 +55,10 @@ export function sendMessage(bot: Bot) {
|
||||
|
||||
if (content.components) validateComponents(bot, content.components);
|
||||
|
||||
if (!content.content?.length && !content.embeds?.length && !content.components?.length && !content.file && !content.stickerIds?.length) {
|
||||
if (
|
||||
!content.content?.length && !content.embeds?.length && !content.components?.length && !content.file &&
|
||||
!content.stickerIds?.length
|
||||
) {
|
||||
throw new Error(
|
||||
"When sending a message, you must provide a value for at least one of content, embeds, stickerIds, components, or file.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user