Heya,
I couldn't type the message, that is more than 200 words, so I decided to code on Pastebin, then evaluate from that.
Pastebin:
X="$(urlfetch json https://www.googleapis.com/youtube/v3/channels?part=statistics&id=*CHANNEL_ID*&key=*API_KEY*)"; "Subscriber: " + X.items[0].statistics.subscriberCount + " | Views: " + X.items[0].statistics.viewCount + " | Total Video: " + X.items[0].statistics.videoCount
Nightbot command: !subs
Nightbot message:
$(eval $(urlfetch json https://pastebin.com/raw/XXXXXXXX))
that API link display: (in browser)
{"kind": "youtube#channelListResponse","etag": "zJ408xk_bLGOHLlwCG8x4w6GWKI","pageInfo": {"resultsPerPage": 1},"items": [{"kind": "youtube#channel","etag": "PWKvUb45dNnpoUrK6mW93W_hj34","id": "UCzkVF-CXaXTiLQXQbLSAeDQ","statistics": {"viewCount": "1687231","commentCount": "0","subscriberCount": "11700","hiddenSubscriberCount": false,"videoCount": "11"}}]}
this is actually my friend's yt channel's stats
BUT WHEN I CALL THE COMMAND, IT DISPLAY "Cannot read property '0' of undefined"
can you tell me why is it so??
Thanks