Skip to content

Commit

Permalink
Add early return to thread enforcement (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcarl authored Mar 19, 2024
1 parent 4203c12 commit 4b3f04b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/features/autothread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ const STAFF_ACCEPT_THRESHOLD = 2;

const autoThread: ChannelHandlers = {
handleMessage: async ({ msg: maybeMessage }) => {
if (
maybeMessage.channel.type === ChannelType.PublicThread ||
maybeMessage.channel.type === ChannelType.PrivateThread
) {
return;
}

const msg = maybeMessage.partial
? await maybeMessage.fetch()
: maybeMessage;
Expand Down
9 changes: 8 additions & 1 deletion src/features/promotion-threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ import { ChannelHandlers } from "../types";
import { threadStats } from "../features/stats";
import { format } from "date-fns";
import fetch from "node-fetch";
import { MessageType } from "discord.js";
import { ChannelType, MessageType } from "discord.js";

const promotionThread: ChannelHandlers = {
handleMessage: async ({ msg: maybeMessage }) => {
if (
maybeMessage.channel.type === ChannelType.PublicThread ||
maybeMessage.channel.type === ChannelType.PrivateThread
) {
return;
}

const msg = maybeMessage.partial
? await maybeMessage.fetch()
: maybeMessage;
Expand Down

0 comments on commit 4b3f04b

Please sign in to comment.