# Path: twitchapi/krakenv5/channels.py
# def getChannelFollowers(channel):
# def getChannelObject(channel):
# def getChannelOauth(channel):
# def getLastSeen(channel):
# def setChannelTitle(channel, title):
# def setChannelGame(channel, game):
# def getChannelId(channel):


import requests
import importlib
import time
import json
import ConfigParser
import logging
import traceback
from logging.handlers import RotatingFileHandler
from datetime import datetime
from twitchapi.krakenv5 import channels
    logger.setLevel(logging.ERROR)
    handler = RotatingFileHandler("twitchapi-log.txt", maxBytes=10000, 
            backupCount=5)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s' \
           + ' - %(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    requests.packages.urllib3.disable_warnings()
    Config = ConfigParser.ConfigParser()
    Config.read('config.ini')
    channelName = Config.get('CHAT', 'channel')

    while(True):
        time.sleep(0.05)
        if not q_twitchapi.empty():
            event = q_twitchapi.get()['event'].split(' ')
            eventArgs = list(event)
            eventHead = event[0]
            eventArgs.remove(eventHead)
            module = importlib.import_module(
                    'twitchapi.commands.%s' % eventHead
                    )
            apiFunc = getattr(module, "react_chat_%s" % eventHead)
            apiFunc(eventArgs)

        checkForNewFollower(channelName, q_twitchbeagle, logger)
        time.sleep(5)

def checkForNewFollower(channel, q_twitchbeagle, logger):
    try:

# Path: twitchapi/krakenv5/channels.py
# def getChannelFollowers(channel):
# def getChannelObject(channel):
# def getChannelOauth(channel):
# def getLastSeen(channel):
# def setChannelTitle(channel, title):
# def setChannelGame(channel, game):
# def getChannelId(channel):


# Path: twitchapi/twitchapirun.py
import requests
import importlib
import time
import json
import ConfigParser
import logging
import traceback
from logging.handlers import RotatingFileHandler
from datetime import datetime
from twitchapi.krakenv5 import channels

    logger.setLevel(logging.ERROR)
    handler = RotatingFileHandler("twitchapi-log.txt", maxBytes=10000, 
            backupCount=5)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s' \
           + ' - %(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    requests.packages.urllib3.disable_warnings()
    Config = ConfigParser.ConfigParser()
    Config.read('config.ini')
    channelName = Config.get('CHAT', 'channel')

    while(True):
        time.sleep(0.05)
        if not q_twitchapi.empty():
            event = q_twitchapi.get()['event'].split(' ')
            eventArgs = list(event)
            eventHead = event[0]
            eventArgs.remove(eventHead)
            module = importlib.import_module(
                    'twitchapi.commands.%s' % eventHead
                    )
            apiFunc = getattr(module, "react_chat_%s" % eventHead)
            apiFunc(eventArgs)

        checkForNewFollower(channelName, q_twitchbeagle, logger)
        time.sleep(5)

def checkForNewFollower(channel, q_twitchbeagle, logger):
    try:

        followers = channels.getChannelFollowers(channel)