Skip to content

Commit 4b3f04b

Browse files
authored
Add early return to thread enforcement (#360)
1 parent 4203c12 commit 4b3f04b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/features/autothread.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ const STAFF_ACCEPT_THRESHOLD = 2;
1818

1919
const autoThread: ChannelHandlers = {
2020
handleMessage: async ({ msg: maybeMessage }) => {
21+
if (
22+
maybeMessage.channel.type === ChannelType.PublicThread ||
23+
maybeMessage.channel.type === ChannelType.PrivateThread
24+
) {
25+
return;
26+
}
27+
2128
const msg = maybeMessage.partial
2229
? await maybeMessage.fetch()
2330
: maybeMessage;

src/features/promotion-threads.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ import { ChannelHandlers } from "../types";
44
import { threadStats } from "../features/stats";
55
import { format } from "date-fns";
66
import fetch from "node-fetch";
7-
import { MessageType } from "discord.js";
7+
import { ChannelType, MessageType } from "discord.js";
88

99
const promotionThread: ChannelHandlers = {
1010
handleMessage: async ({ msg: maybeMessage }) => {
11+
if (
12+
maybeMessage.channel.type === ChannelType.PublicThread ||
13+
maybeMessage.channel.type === ChannelType.PrivateThread
14+
) {
15+
return;
16+
}
17+
1118
const msg = maybeMessage.partial
1219
? await maybeMessage.fetch()
1320
: maybeMessage;

0 commit comments

Comments
 (0)