From 2b1a4d915816deb35eee2baf530a1eee81dcc49d Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 5 Feb 2022 11:24:48 -0500 Subject: automod - fix error when message can't be fetched --- src/listeners/message/automodUpdate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/listeners/message') diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts index c96a5a9..d2e6f40 100644 --- a/src/listeners/message/automodUpdate.ts +++ b/src/listeners/message/automodUpdate.ts @@ -1,4 +1,4 @@ -import { AutoMod, BushListener, type BushClientEvents, type BushMessage } from '#lib'; +import { AutoMod, BushListener, type BushClientEvents } from '#lib'; export default class AutomodMessageUpdateListener extends BushListener { public constructor() { @@ -10,7 +10,8 @@ export default class AutomodMessageUpdateListener extends BushListener { } public override async exec(...[_, newMessage]: BushClientEvents['messageUpdate']) { - const fullMessage = newMessage.partial ? await newMessage.fetch() : (newMessage as BushMessage); + const fullMessage = newMessage.partial ? await newMessage.fetch().catch(() => null) : newMessage; + if (!fullMessage) return; return new AutoMod(fullMessage); } } -- cgit