Skip to content

Commit

Permalink
schedulers(liveStreams): log http errors >= 400
Browse files Browse the repository at this point in the history
Signed-off-by: TRACTION <19631364+iamtraction@users.noreply.github.com>
  • Loading branch information
iamtraction committed Nov 19, 2023
1 parent f6f4689 commit 7548378
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/schedulers/liveStreams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ class LiveStreamNotificationScheduler extends Scheduler {
// twitch streams
if (guild.twitchNotificationChannel && this.client.guilds.cache.get(guild.id).channels.cache.has(guild.twitchNotificationChannel) && guild.twitchNotificationUsers?.length) {
// get current live streams
const { body } = await requests.get("https://api.twitch.tv/helix/streams/?user_login=" + guild.twitchNotificationUsers.join("&user_login="), {
const { body, statusCode } = await requests.get("https://api.twitch.tv/helix/streams/?user_login=" + guild.twitchNotificationUsers.join("&user_login="), {
"authorization": "Bearer " + (this.client.settings as Settings).get("twitch").accessToken,
"client-id": (this.client.settings as Settings).get("twitch").clientId,
});

if (statusCode >= 400) {
Logger.error(await body.json());
}

const streams: TwitchStream[] = (await body.json())?.["data"] || [];

// streams that were already notified
Expand Down

0 comments on commit 7548378

Please sign in to comment.