Skip to content

Commit 5b553c3

Browse files
committed
chore: lint + update dependabot flow for bun
1 parent 28f6201 commit 5b553c3

File tree

11 files changed

+824
-196
lines changed

11 files changed

+824
-196
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
version: 2
2+
enable-beta-ecosystems: true
23
updates:
34
- package-ecosystem: "npm"
45
directory: "/"

.github/workflows/lockb.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

bun.lock

Lines changed: 577 additions & 0 deletions
Large diffs are not rendered by default.

bun.lockb

-106 KB
Binary file not shown.

src/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Bun from "bun";
12
import { heapStats } from "bun:jsc";
23
import { ChannelType, GuildMember, type CommandInteraction } from "discord.js";
34
import { PermissionFlagsBits } from "discord-api-types/v8";

src/utils/logging.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
import type { Platforms } from "../types/types";
22

3-
export async function logMessage(platform: Platforms, channelName: string, channelId: string, guildName: string, guildId: string) {
3+
export async function logMessage(
4+
platform: Platforms,
5+
channelName: string,
6+
channelId: string,
7+
guildName: string,
8+
guildId: string,
9+
) {
410
const platformEmojis: { [key in Platforms]: string } = {
5-
YouTube: '❤️',
6-
Twitch: '💜',
11+
YouTube: "❤️",
12+
Twitch: "💜",
713
};
814

915
const actionMessages: { [key in Platforms]: string } = {
10-
YouTube: 'upload',
11-
Twitch: 'live',
16+
YouTube: "upload",
17+
Twitch: "live",
1218
};
1319

14-
console.log(`${platformEmojis[platform]} [${platform}] Sent ${actionMessages[platform]} message to ${guildName} (${guildId}) for channel ${channelName} (${channelId})`);
15-
}
20+
console.log(
21+
`${platformEmojis[platform]} [${platform}] Sent ${actionMessages[platform]} message to ${guildName} (${guildId}) for channel ${channelName} (${channelId})`,
22+
);
23+
}

src/utils/twitch/getStreamerId.ts

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
1-
import { twitchToken } from "./auth";
21
import { env } from "../../config";
32

4-
export async function getStreamerId(streamerId: string): Promise<string | null> {
5-
if (!twitchToken || !env.twitchClientId) {
6-
console.error("Twitch token not found in getStreamerId");
7-
return null;
8-
}
9-
10-
const res = await fetch(`https://api.twitch.tv/helix/users?login=${streamerId.toLowerCase()}`, {
11-
headers: {
12-
'Client-ID': env.twitchClientId,
13-
'Authorization': `Bearer ${twitchToken}`,
14-
},
15-
});
16-
17-
if (!res.ok) {
18-
console.error("Error fetching stream data in checkIfStreamerIsLive:", res.statusText);
19-
return null
20-
}
21-
22-
const data = await res.json();
23-
console.log("Streamer data:", data);
24-
if (data.data && data.data.length > 0) {
25-
return data.data[0].id;
26-
} else {
27-
return null;
28-
}
29-
}
3+
import { twitchToken } from "./auth";
4+
5+
export async function getStreamerId(
6+
streamerId: string,
7+
): Promise<string | null> {
8+
if (!twitchToken || !env.twitchClientId) {
9+
console.error("Twitch token not found in getStreamerId");
10+
11+
return null;
12+
}
13+
14+
const res = await fetch(
15+
`https://api.twitch.tv/helix/users?login=${streamerId.toLowerCase()}`,
16+
{
17+
headers: {
18+
"Client-ID": env.twitchClientId,
19+
Authorization: `Bearer ${twitchToken}`,
20+
},
21+
},
22+
);
23+
24+
if (!res.ok) {
25+
console.error(
26+
"Error fetching stream data in checkIfStreamerIsLive:",
27+
res.statusText,
28+
);
29+
30+
return null;
31+
}
32+
33+
const data = await res.json();
34+
35+
console.log("Streamer data:", data);
36+
if (data.data && data.data.length > 0) {
37+
return data.data[0].id;
38+
} else {
39+
return null;
40+
}
41+
}
Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
import { env } from "../../config";
2+
23
import { twitchToken } from "./auth";
34

4-
export async function getStreamerName(streamerId: string): Promise<string | null> {
5-
if (!twitchToken || !env.twitchClientId) {
6-
console.error("Twitch token not found in getStreamerName");
7-
return null;
8-
}
9-
10-
const res = await fetch(`https://api.twitch.tv/helix/users?id=${streamerId}`, {
11-
headers: {
12-
'Client-ID': env.twitchClientId,
13-
'Authorization': `Bearer ${twitchToken}`,
14-
},
15-
});
16-
17-
if (!res.ok) {
18-
console.error("Error fetching stream data in getStreamerName:", res.statusText);
19-
return null;
20-
}
21-
22-
const data = await res.json();
23-
console.log("Streamer data:", data);
24-
if (data.data && data.data.length > 0) {
25-
return data.data[0].display_name;
26-
} else {
27-
return null;
28-
}
29-
}
5+
export async function getStreamerName(
6+
streamerId: string,
7+
): Promise<string | null> {
8+
if (!twitchToken || !env.twitchClientId) {
9+
console.error("Twitch token not found in getStreamerName");
10+
11+
return null;
12+
}
13+
14+
const res = await fetch(
15+
`https://api.twitch.tv/helix/users?id=${streamerId}`,
16+
{
17+
headers: {
18+
"Client-ID": env.twitchClientId,
19+
Authorization: `Bearer ${twitchToken}`,
20+
},
21+
},
22+
);
23+
24+
if (!res.ok) {
25+
console.error(
26+
"Error fetching stream data in getStreamerName:",
27+
res.statusText,
28+
);
29+
30+
return null;
31+
}
32+
33+
const data = await res.json();
34+
35+
console.log("Streamer data:", data);
36+
if (data.data && data.data.length > 0) {
37+
return data.data[0].display_name;
38+
} else {
39+
return null;
40+
}
41+
}
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import { env } from "../../config"
1+
import { env } from "../../config";
22

33
export default async function checkIfChannelIdIsValid(channelId: string) {
4-
const res = await fetch(`https://www.googleapis.com/youtube/v3/channels?part=snippet&id=${channelId}&key=${env.youtubeApiKey}`);
5-
const data = await res.json();
6-
return data.items !== undefined && data.items.length > 0;
7-
}
4+
const res = await fetch(
5+
`https://www.googleapis.com/youtube/v3/channels?part=snippet&id=${channelId}&key=${env.youtubeApiKey}`,
6+
);
7+
const data = await res.json();
8+
9+
return data.items !== undefined && data.items.length > 0;
10+
}

0 commit comments

Comments
 (0)