Skip to content

Commit a0cfb42

Browse files
authored
Merge pull request #189 from GalvinPython/fix/null-channels
2 parents 8624214 + 26514b0 commit a0cfb42

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/events/ready.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ client.once(Events.ClientReady, async (bot) => {
1818
// await cronUpdateBotInfo();
1919
// }).start();
2020

21+
console.log(
22+
`Setting intervals: YouTube - ${config.updateIntervalYouTube}ms, Twitch - ${config.updateIntervalTwitch}ms`,
23+
);
24+
2125
fetchLatestUploads();
2226
setInterval(fetchLatestUploads, config.updateIntervalYouTube as number);
2327

src/utils/youtube/fetchLatestUploads.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,26 @@ export default async function fetchLatestUploads() {
7979
const videoId =
8080
playlist.snippet.thumbnails.default.url.split("/")[4];
8181

82+
if (!channelDict[channelId]) {
83+
console.error(
84+
"Channel ID not found in channelDict:",
85+
channelId,
86+
);
87+
continue;
88+
}
89+
8290
const requiresUpdate =
8391
channelDict[channelId].latestAllId !== videoId;
8492

85-
console.log(
86-
"Channel ID:",
87-
channelId,
88-
"Video ID:",
89-
videoId,
90-
"Requires update?",
91-
requiresUpdate,
92-
);
93-
9493
if (requiresUpdate) {
94+
console.log(
95+
"Channel ID:",
96+
channelId,
97+
"Video ID:",
98+
videoId,
99+
"Requires update?",
100+
requiresUpdate,
101+
);
95102
const [longVideoId, shortVideoId, streamVideoId] =
96103
await Promise.all([
97104
getSinglePlaylistAndReturnVideoData(

0 commit comments

Comments
 (0)