Closed yagizdo closed 6 years ago
I'm not sure which code you're referring to, but you can get a channel's uptime or sub count using the Twitch APIs:
Using the streams Helix API
https://api.twitch.tv/helix/streams
If data
has a length
greater than 0
then the timestamp at data[0].started_at
is what you want, otherwise the channel is probably offline.
Using the channel subscriptions Kraken API
https://api.twitch.tv/kraken/channels/<channel ID>/subscriptions
If you have permission then the value at _total
is mostly what you want.
Using the subscriber count API (unsupported)
https://api.twitch.tv/api/channels/dome/subscriber_count
This endpoint is/was used on the channel dashboard to show subscriber count and points. It also includes breakdowns and each and amount of score needed for additional emote slots. (next_level
values will always be 0
for affiliates)
Example data:
{
"count": 100,
"score": 122,
"count_breakdown": [
{
"plan": "1000",
"count": 90
}, {
"plan": "2000",
"count": 7
}, {
"plan": "3000",
"count": 3
}
],
"score_breakdown": [
{
"plan": "1000",
"score": 90
}, {
"plan": "2000",
"score": 14
}, {
"plan": "3000",
"score": 18
}
],
"next_level": {
"minimum_score": 300,
"emoticon_limit": 16
}
}
Here is a full-ish example: https://gist.github.com/AlcaDesign/02a5e9bcedf483be99621bad69ca1896
Hi. I used your code to write a bot for my own channel. But I couldn't see the code for the! Uptime and! Subcount style commands. Do you have the chance to add? Or can you show us the way?
Actual behaviour:
Expected behaviour:
Error log:
Server configuration