diff --git a/@types/Client.ts b/@types/Client.ts index 24cec32..fb99421 100644 --- a/@types/Client.ts +++ b/@types/Client.ts @@ -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 diff --git a/src/client/components/ModerationManager.ts b/src/client/components/ModerationManager.ts index 0ba2c0d..819e347 100644 --- a/src/client/components/ModerationManager.ts +++ b/src/client/components/ModerationManager.ts @@ -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