Skip to content

Commit

Permalink
workaround for discordjs/discord.js#9648... again *sigh*
Browse files Browse the repository at this point in the history
Signed-off-by: RedGuy12 <paul@reid-family.org>
  • Loading branch information
RedGuy12 committed Jun 13, 2023
1 parent 8aee9e8 commit b5fd0ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions modules/logging/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ export async function getLoggingThread(group?: LogGroup | typeof DATABASE_THREAD
if (!config.channels.modlogs) throw new ReferenceError("Cannot find logs channel");
if (!group) return config.channels.modlogs;

const threads = await config.channels.modlogs.threads.fetchActive();
const threads = await config.guild.channels.fetchActiveThreads();

return (
threads.threads.find((thread) => thread.name === group) ||
threads.threads.find(
(thread) => thread.parent?.id === config.channels.modlogs?.id && thread.name === group,
) ||
(await config.channels.modlogs.threads.create({
name: group,
reason: "New logging thread",
Expand Down
8 changes: 6 additions & 2 deletions modules/modInterestForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import constants from "../common/constants.js";
import giveXp from "./xp/giveXp.js";

if (!config.channels.admin) throw new ReferenceError("Could not find admin channel");
const threads = await config.channels.admin.threads.fetchActive();
const threads = await config.guild.channels.fetchActiveThreads();
const thread =
threads.threads.find((thread) => thread.name === "Moderator Interest Forms") ||
threads.threads.find(
(thread) =>
thread.parent?.id === config.channels.admin?.id &&
thread.name === "Moderator Interest Forms",
) ||
(await config.channels.admin.threads.create({
name: "Moderator Interest Forms",
reason: "For mod interest forms",
Expand Down
7 changes: 5 additions & 2 deletions modules/tickets/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export async function getThreadFromMember(
): Promise<ThreadChannel | void> {
if (!config.channels.tickets) return;

const { threads } = await config.channels.tickets.threads.fetchActive();
const { threads } = await config.guild.channels.fetchActiveThreads();

return (
await asyncFilter(
threads.toJSON(),
async (thread) => (await getUserFromTicket(thread))?.id === user.id && thread,
async (thread) =>
thread.parent?.id === config.channels.tickets?.id &&
(await getUserFromTicket(thread))?.id === user.id &&
thread,
).next()
).value;
}
Expand Down

0 comments on commit b5fd0ec

Please sign in to comment.