Skip to content

Commit b883478

Browse files
committed
fix(youtube): make content type selection work in fetchLatestUploads
1 parent 2d9f693 commit b883478

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

src/utils/youtube/fetchLatestUploads.ts

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -196,48 +196,14 @@ export default async function fetchLatestUploads() {
196196
guild,
197197
): guild is typeof dbGuildYouTubeSubscriptionsTable.$inferSelect =>
198198
"youtubeChannelId" in guild &&
199-
"trackVideos" in guild &&
200-
"trackShorts" in guild &&
201-
"trackStreams" in guild,
199+
((contentType === PlaylistType.Video &&
200+
guild.trackVideos) ||
201+
(contentType === PlaylistType.Short &&
202+
guild.trackShorts) ||
203+
(contentType === PlaylistType.Stream &&
204+
guild.trackStreams)),
202205
),
203206
});
204-
205-
// console.log("Discord guilds to update:", discordGuildsToUpdate);
206-
// for (const guild of discordGuildsToUpdate) {
207-
// try {
208-
// const channelObj = await client.channels.fetch(
209-
// guild.guild_channel_id,
210-
// );
211-
212-
// if (
213-
// !channelObj ||
214-
// (channelObj.type !== ChannelType.GuildText &&
215-
// channelObj.type !==
216-
// ChannelType.GuildAnnouncement)
217-
// ) {
218-
// console.error(
219-
// "Invalid channel or not a text channel in fetchLatestUploads",
220-
// );
221-
// continue;
222-
// }
223-
224-
// await (channelObj as TextChannel).send({
225-
// content:
226-
// guild.guild_ping_role && channelInfo
227-
// ? `<@&${guild.guild_ping_role}> New video uploaded for ${channelInfo?.channelName}! https://www.youtube.com/watch?v=${videoId}`
228-
// : guild.guild_ping_role
229-
// ? `<@&${guild.guild_ping_role}> New video uploaded! https://www.youtube.com/watch?v=${videoId}`
230-
// : channelInfo
231-
// ? `New video uploaded for ${channelInfo.channelName}! https://www.youtube.com/watch?v=${videoId}`
232-
// : `New video uploaded! https://www.youtube.com/watch?v=${videoId}`,
233-
// });
234-
// } catch (error) {
235-
// console.error(
236-
// "Error fetching or sending message to channel in fetchLatestUploads:",
237-
// error,
238-
// );
239-
// }
240-
// }
241207
}
242208
}
243209
}

0 commit comments

Comments
 (0)