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
4 changes: 4 additions & 0 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ client.once(Events.ClientReady, async (bot) => {
// await cronUpdateBotInfo();
// }).start();

console.log(
`Setting intervals: YouTube - ${config.updateIntervalYouTube}ms, Twitch - ${config.updateIntervalTwitch}ms`,
);

fetchLatestUploads();
setInterval(fetchLatestUploads, config.updateIntervalYouTube as number);

Expand Down
25 changes: 16 additions & 9 deletions src/utils/youtube/fetchLatestUploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,26 @@ export default async function fetchLatestUploads() {
const videoId =
playlist.snippet.thumbnails.default.url.split("/")[4];

if (!channelDict[channelId]) {
console.error(
"Channel ID not found in channelDict:",
channelId,
);
continue;
}

const requiresUpdate =
channelDict[channelId].latestAllId !== videoId;

console.log(
"Channel ID:",
channelId,
"Video ID:",
videoId,
"Requires update?",
requiresUpdate,
);

if (requiresUpdate) {
console.log(
"Channel ID:",
channelId,
"Video ID:",
videoId,
"Requires update?",
requiresUpdate,
);
const [longVideoId, shortVideoId, streamVideoId] =
await Promise.all([
getSinglePlaylistAndReturnVideoData(
Expand Down