from .base import BaseHandler
import logging

logger = logging.getLogger("pybot.{}".format(__name__))
_log = []
_webhook_is_set = False


class WebHook(BaseHandler):
    def data_received(self, chunk):
        pass

    def get(self, *args, **kwargs):
        self.write_json({"log": _log})


class OnMessage(BaseHandler):
    def data_received(self, chunk):
        pass

    def get(self, *args, **kwargs):
        self.write_json({"log": _log})

    def post(self, *args, **kwargs):
        _log.append(self.request.body)
        logger.info("new msg - {}".format(self.request.body))
        self.write_json({})

