Skip to content

Commit 788250e

Browse files
authored
Merge branch 'dev' into dependabot/bun/dev/discord.js-14.22.1
2 parents 20c2920 + a0cfb42 commit 788250e

File tree

6 files changed

+61
-18
lines changed

6 files changed

+61
-18
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Galvin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Just to make life a bit easier :P
22

33
setup:
4-
./scripts/setup.sh
4+
bash ./scripts/setup.sh
55

66
delete:
7-
./scripts/setup_delete.sh
7+
bash ./scripts/setup_delete.sh
88

99
update:
10-
./scripts/update.sh
10+
bash ./scripts/update.sh

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "feedr",
33
"module": "src/index.ts",
44
"type": "module",
5-
"version": "2.0.0-dev",
5+
"version": "2.0.0-hotfix.1",
66
"devDependencies": {
77
"@types/bun": "1.2.21",
88
"@types/pg": "^8.11.14",

scripts/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Description=Feedr Bot Service
3232
After=network.target
3333
3434
[Service]
35-
WorkingDirectory=${WORKDIR}/src
36-
ExecStart=${BUN_PATH} run index.ts
35+
WorkingDirectory=${WORKDIR}
36+
ExecStart=${BUN_PATH} run src/index.ts
3737
Restart=on-failure
3838
User=$USER
3939
Environment=NODE_ENV=production

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: 30 additions & 12 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(
@@ -117,15 +124,26 @@ export default async function fetchLatestUploads() {
117124

118125
let contentType: PlaylistType | null = null;
119126

127+
if (videoId == longVideoId.videoId) {
128+
contentType = PlaylistType.Video;
129+
} else if (videoId == shortVideoId.videoId) {
130+
contentType = PlaylistType.Short;
131+
} else if (videoId == streamVideoId.videoId) {
132+
contentType = PlaylistType.Stream;
133+
} else {
134+
console.error(
135+
"Video ID does not match any fetched video IDs for channel",
136+
channelId,
137+
);
138+
}
139+
120140
const videoIdMap = {
121141
[PlaylistType.Video]: longVideoId,
122142
[PlaylistType.Short]: shortVideoId,
123143
[PlaylistType.Stream]: streamVideoId,
124144
};
125145

126-
contentType = Object.entries(videoIdMap).find(
127-
([, id]) => id,
128-
)?.[0] as PlaylistType | null;
146+
console.log("Determined content type:", contentType);
129147

130148
if (contentType) {
131149
console.log(

0 commit comments

Comments
 (0)