M
apps/bot/src/feats/tickets/buttons.ts
→
apps/bot/src/feats/tickets/buttons.ts
@@ -10,7 +10,7 @@ TextDisplayBuilder,
} from "discord.js";
import { kitten } from "@/client";
-import { PublicError, errorMessage, getTextChannel, handleError } from "@/lib";
+import { PublicError, errorMessage, getTextChannel, handleError, logger } from "@/lib";
import { useGetTicketData } from "@/middleware";
import * as actions from "./actions";
@@ -239,13 +239,18 @@ const { ticket } = ctx;
if (!ticket) return errorMessage(interaction, "Failed to find ticket");
const { guild } = ticket;
+ if (!guild) return errorMessage(interaction, "Failed to find guild");
const thankedAt = ticket.thankedAt;
if (thankedAt) return errorMessage(interaction, "You already thanked for this ticket");
- const channelRes = await Result.fromAsync(getTextChannel(guild.ticketLogChannel!));
- if (!channelRes.unwrapErr())
+ if (!guild.ticketLogChannel) return errorMessage(interaction, "Ticket log channel is not set");
+
+ const channelRes = await Result.fromAsync(getTextChannel(guild.ticketLogChannel));
+ if (channelRes.isErr()) {
+ logger.error(channelRes.unwrapErr(), "failed to find ticket log channel");
return errorMessage(interaction, "Failed to find ticket log channel");
+ }
const channel = channelRes.unwrap();
await editTicket(ticket.id, {
@@ -258,7 +263,7 @@ content: `The reporter said thank you for handling ticket #${ticket.localId}! 💖`,
}),
interaction.reply({
content: "A thank you has been sent! 💖",
- ephemeral: true,
+ flags: ["Ephemeral"],
}),
]).catch(() => {});
},