Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 69 additions & 8 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lib/": "./src/lib/",
"interfaces/": "./src/interfaces/",
"commands/": "./src/commands/",
"npm:discord.js": "npm:discord.js@14.11.0",
"npm:discord.js": "npm:discord.js@^14.16.0",
"npm:@prisma/client": "npm:@prisma/client@5.0.0",
"npm:prisma": "npm:prisma@^5.0.0",
"npm:axios": "npm:axios@^1.4.0",
Expand Down
7 changes: 5 additions & 2 deletions src/commands/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import {
ChannelType,
type ChatInputCommandInteraction,
Collection,
type GuildTextChannelType,
PermissionFlagsBits,
SlashCommandBuilder,
type SlashCommandStringOption,
SlashCommandSubcommandBuilder,
type TextBasedChannel,
type TextChannel,
} from "npm:discord.js"
import client from "lib/prisma.ts"
import { type CommandV2 } from "interfaces/command.ts"
Expand Down Expand Up @@ -91,11 +93,12 @@ export const command: CommandV2 = {
channel = interaction.options.getChannel(
"channel",
true,
) as TextBasedChannel
[ChannelType.GuildText],
)
}

// error if the channel didnt get set for some reason
if (channel == null || channel.type === ChannelType.GuildStageVoice) {
if (channel == null || !channel.isSendable()) {
return await interaction.editReply("Invalid channel")
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/episodeNotifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { addLeadingZeros, toRanges } from "lib/util.ts"

export function isTextChannel(
channel: Channel,
): channel is AnyThreadChannel<boolean> | TextChannel {
): channel is AnyThreadChannel | TextChannel {
return channel.isTextBased() && !channel.isDMBased() &&
![ChannelType.GuildVoice].includes(channel.type)
}
Expand Down
9 changes: 7 additions & 2 deletions src/lib/morningSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ export async function sendMorningSummary(
},
})

const embed: APIEmbed = await getUpcomingEpisodesEmbed(shows, 1)
const embed: APIEmbed = getUpcomingEpisodesEmbed(shows, 1)

for (const dest of settings.morningSummaryDestinations) {
const channel = await c.channels.fetch(dest.channelId)
if (channel == null || !isTextChannel(channel)) continue
if (channel == null || !isTextChannel(channel) || !channel.isSendable()) {
console.warn(
`Found channel ${dest.channelId} in the morning summary destinations but it is not a text channel or is not sendable`,
)
continue
}

await channel.send({
content: "",
Expand Down