Skip to content

Commit

Permalink
fix: Check if channel is text-based instead of just text channel
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton committed Apr 14, 2023
1 parent 78bf6db commit 1c40668
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/commands/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const generateFinalReport = async (): Promise<void> => {

const announcementsChannel = await getAnnoucementsChannel();

if (announcementsChannel?.type !== ChannelType.GuildText) {
if (!announcementsChannel.isTextBased()) {
throw new Error('Announcements channel is not a text channel.');
}

Expand Down Expand Up @@ -255,7 +255,7 @@ export default class Progress extends SlashCommand {

const updatesChannel = await getUpdatesChannel();

if (updatesChannel?.type !== ChannelType.GuildText) {
if (!updatesChannel.isTextBased()) {
throw new Error('Updates channel is not a text channel.');
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/guildMemberAdd.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import client from '../client';
import { ChannelType, Events } from 'discord.js';
import { Events } from 'discord.js';
import { getGeneralChannel } from '../util';

client.on(Events.GuildMemberAdd, async (member) => {
const generalChannel = await getGeneralChannel();

if (generalChannel?.type !== ChannelType.GuildText) {
if (!generalChannel.isTextBased()) {
throw new Error('General channel is not a text channel.');
}

Expand Down

0 comments on commit 1c40668

Please sign in to comment.