Skip to content

Commit

Permalink
Change Twitch API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
acdvs committed Jan 22, 2024
1 parent 6679b6c commit 6527c20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/util/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ type UserData = {
id: string;
};
};

type UserError = {
err: string;
};

type UserResponse = UserData | UserError;

export const getTwitchId = async (channelName: string) => {
const res = await fetch(`https://api.retpaladinbot.com/twitch/id?user=${channelName}`);
const res = await fetch(`http://itsathirdpartything.com/twitch/id/${channelName}`);

if (res.ok) {
const data: UserResponse = await res.json();

if ('data' in data) {
return data.data.id;
}
return data;
}
};
2 changes: 1 addition & 1 deletion src/util/emotes/twitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ChannelRes = {
};

export async function getChannelEmotes(channelId: string) {
const res = await fetch(`https://api.retpaladinbot.com/twitch/emotes?id=${channelId}`);
const res = await fetch(`http://itsathirdpartything.com/twitch/emotes/${channelId}`);
const data: ChannelRes = await res.json();

const emotes: Emote[] = data.data.map((e: EmoteRes) => ({
Expand Down

0 comments on commit 6527c20

Please sign in to comment.