1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Added a method to check if a channel is online

This commit is contained in:
Phxntxm 2016-07-10 11:34:27 -05:00
parent 467fc40797
commit ebc6ea4393

View file

@ -3,8 +3,15 @@ from .utils import config
import urllib.request
import urllib.parse
import discord
import json
import re
def channelOnline(channel: str):
url = "https://api.twitch.tv/kraken/streams/{}".format(channel)
response = urllib.request.urlopen(url)
data = json.loads(response.read().decode('utf-8'))
return data['stream'] is not None
class Twitch:
"""Class for some twitch integration"""
def __init__(self, bot):