Skip to content

Commit

Permalink
Updated to reflect new discordJS channel API
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyan114 committed Oct 12, 2024
1 parent 8962fd0 commit c39915a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import readline from "readline";
import axios from "axios";
import {client as WebSocketClient, connection} from "websocket";
import {ActionRowBuilder, ButtonBuilder, ButtonStyle, ColorResolvable, EmbedBuilder, Message} from "discord.js";
import {ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, ColorResolvable, EmbedBuilder, Message} from "discord.js";
import os from "os";
import {BaseEvent, ExtendedClient, SponsorType} from "../structure";

Expand Down Expand Up @@ -87,7 +87,7 @@ export default class ReadyEvent extends BaseEvent {
});
} else {
const channel = this.client.channels.cache.get(this.client.config.openTicketChannelId);
if(!channel || !channel.isTextBased()) return console.error("Invalid openTicketChannelId");
if(!channel || channel.type !== ChannelType.GuildText) return console.error("Invalid openTicketChannelId");
channel.send({
embeds: [embed],
components: [row]
Expand Down
4 changes: 4 additions & 0 deletions src/utils/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export async function close(
components: [rowAction]
})
.catch((e) => console.log(e));

// Workaround for type handling, rewrite should not follow this.
if(interaction.channel && interaction.channel.type !== ChannelType.GuildText)
throw Error("Close util used in a non-text channel");

interaction.channel
?.send({
Expand Down

0 comments on commit c39915a

Please sign in to comment.