Skip to content

Commit

Permalink
fix(getChannelSubscribers): fix for checking broadcasterType
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Jan 3, 2022
1 parent 779c43c commit cbb6a92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/twitch/calls/getChannelSubscribers.ts
Expand Up @@ -21,14 +21,14 @@ export async function getChannelSubscribers<T extends { noAffiliateOrPartnerWarn
const broadcasterType = variables.get('services.twitch.broadcasterType') as string;
const clientBroadcaster = await client('broadcaster');

const getSubscriptionsPaginated = await clientBroadcaster.subscriptions.getSubscriptionsPaginated(broadcasterId).getAll();
if (broadcasterType === '') {
if (broadcasterType !== 'partner' && broadcasterType !== 'affiliate') {
if (!opts.noAffiliateOrPartnerWarningSent) {
warning('Broadcaster is not affiliate/partner, will not check subs');
apiStats.value.currentSubscribers = 0;
}
return { state: false, opts: { ...opts, noAffiliateOrPartnerWarningSent: true } };
}
const getSubscriptionsPaginated = await clientBroadcaster.subscriptions.getSubscriptionsPaginated(broadcasterId).getAll();
apiStats.value.currentSubscribers = getSubscriptionsPaginated.length - 1; // exclude owner
setSubscribers(getSubscriptionsPaginated.filter(o => !isBotId(o.userId)));
if (getSubscriptionsPaginated.find(o => isBotId(o.userId))) {
Expand Down

0 comments on commit cbb6a92

Please sign in to comment.