aboutsummaryrefslogtreecommitdiff
path: root/src/listeners/message
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-05 11:24:48 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-05 11:24:48 -0500
commit2b1a4d915816deb35eee2baf530a1eee81dcc49d (patch)
treee7715945bd2f5426dcb813bde7c3e83de3f1dd8a /src/listeners/message
parent7fce00cec4d5ccb49636116b7eccc1e5c79fdd70 (diff)
downloadtanzanite-2b1a4d915816deb35eee2baf530a1eee81dcc49d.tar.gz
tanzanite-2b1a4d915816deb35eee2baf530a1eee81dcc49d.tar.bz2
tanzanite-2b1a4d915816deb35eee2baf530a1eee81dcc49d.zip
automod - fix error when message can't be fetched
Diffstat (limited to 'src/listeners/message')
-rw-r--r--src/listeners/message/automodUpdate.ts5
1 files changed, 3 insertions, 2 deletions
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);
}
}