Bugfix hopefully

This commit is contained in:
Erik 2023-12-08 21:27:50 +02:00
parent 6fa715fb8b
commit 8dc57444b2
2 changed files with 3 additions and 3 deletions

View File

@ -384,7 +384,7 @@ export type BaseInfractionData = {
arguments?: InfractionArguments,
targetType?: InfractionTargetType,
guild: GuildWrapper,
channel?: GuildTextBasedChannel,
channel?: GuildTextBasedChannel | null,
invoker?: InvokerWrapper | null,
target?: MemberWrapper | UserWrapper | GuildTextBasedChannel,
executor?: MemberWrapper | UserWrapper

View File

@ -554,8 +554,8 @@ class ModerationManager implements Initialisable
{
const executor = await guild.memberWrapper(i.executor!).catch(() => null) ?? await guild.memberWrapper(guild.me!);
const channel = guild.channels.resolve(i.channel!);
if (!channel?.isTextBased())
throw new Error('Bad channel');
if (channel && !channel.isTextBased())
throw new Error('Bad channel ' + inspect(i));
if (!executor)
throw new Error('Missing executor');
try