This commit is contained in:
2025-06-30 21:01:02 +01:00
parent 76bee93338
commit a2bcc1dcc1
2 changed files with 28 additions and 0 deletions

View File

@ -38,6 +38,7 @@ export const twitchChallengeEvent = z.object({
})
});
// Not the complete event, but the information we need.
export const twitchFollowEvent = z.object({
subscription: z.object({
@ -114,7 +115,26 @@ export const createTwitchClient = () => {
console.log("Subscribe to follow: ", res);
};
const getSubscriptionStatus = async () => {
const twitchSubResponse = await fetch(
"https://api.twitch.tv/helix/eventsub/subscriptions",
{
headers: {
Authorization: `Bearer ${await _access_token}`,
"Client-Id": TWITCH_APP_CLIENT_ID,
"Content-Type": "application/json",
},
},
);
const res = await twitchSubResponse.json();
console.log("-------------------")
console.log("Subscription status");
console.log(res);
}
return {
subscribeToFollow,
getSubscriptionStatus,
};
};

8
src/routes/+page.ts Normal file
View File

@ -0,0 +1,8 @@
import { twitchClient } from "$lib";
import type { PageLoad } from "./$types";
export const load: PageLoad = async ({ params }) => {
await twitchClient.getSubscriptionStatus();
return {};
};