Skip to content

Commit

Permalink
fixes BOT-14
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhappyma committed Mar 28, 2024
1 parent 56d1746 commit 0ef2d50
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/modules/deliver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ bot.registerButton(/order:(\d+):deliver/, async (interaction) => {
ephemeral: true,
});

const targetChannel = await (
await bot.client.guilds.fetch(orderP.guildId)
).channels.fetch(orderP.channelId);
try {
var guild = await bot.client.guilds.fetch(orderP.guildId);
} catch (e) {
return interaction.followUp({
content: `Failed to fetch guild! This usually means the bot was kicked, and if so just reject the order. Here's the error:\n\`\`\`${e}\`\`\``,
ephemeral: true,
});
}
const targetChannel = guild.channels.cache.get(orderP.channelId);
if (!targetChannel?.isTextBased() || targetChannel.isThread())
return interaction.followUp({ content: "Failed to fetch order channel" });
try {
Expand Down

0 comments on commit 0ef2d50

Please sign in to comment.