fix(plugins): type errors (#2472)

* fix plugins

* deno fmt
This commit is contained in:
LTS20050703
2022-09-15 21:45:54 +07:00
committed by GitHub
parent a49c7499cb
commit 9426f4e2de
4 changed files with 11 additions and 15 deletions

View File

@@ -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);
}

View File

@@ -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);
};
}

View File

@@ -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);
};
}

View File

@@ -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.",
);