PythonistaGuild / TwitchIO

An Async Bot/API wrapper for Twitch made in Python.
https://twitchio.dev
MIT License
791 stars 163 forks source link

Add a method to obtain the total number of followers on twitchio.User #348

Closed graille closed 1 year ago

graille commented 1 year ago

Hello,

It would be nice to have a dedicated method to obtain the number of followers of a channel, without having to fetch the entire list of followers.

According to Twitch API Reference, this data is available in the response (the "total" attribute), but it is not used in TwitchIO. The only method provided hitting this endpoint is "twitchio.User.fetch_followers" which returns ALL the followers (500k+ at each request in my case, when I only want to know the number of followers O_O).

Would be nice to have a method like "fetch_followers_number" or "fetch_total_followers" which basically call the same endpoint as fetch_followers but with parameter first=1 to avoid useless Twitch server overload, and which would just return the "total" attribute from the response.

github-actions[bot] commented 1 year ago

Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server

Else if you have an issue with the library please wait for someone to help you here.

chillymosh commented 1 year ago

This already exists and can be accessed by installing Master directly

PartialUser.fetch_follower_count
(https://twitchio.readthedocs.io/en/latest/reference.html#twitchio.PartialUser.fetch_follower_count)
PartialUser.fetch_following_count
(https://twitchio.readthedocs.io/en/latest/reference.html#twitchio.PartialUser.fetch_following_count)