def _bot_cmd(self, method, endpoint, *args, **kwargs):
    base_api = 'https://api.telegram.org/bot{api_key}/{endpoint}'
    endpoint = base_api.format(api_key=self.config['api_key'], endpoint=endpoint)
    try:
        response = method(endpoint, data=kwargs.get('data', None), params=kwargs.get('params', {}), **self.config['requests_kwargs'])
        if (response.status_code != 200):
            raise ValueError('Got unexpected response. ({}) - {}'.format(response.status_code, response.text))
        return response.json()
    except Exception as e:
        return {'ok': False, 'error': str(e)}
def _bot_cmd(self, method, endpoint, *args, **kwargs):
    base_api = 'https://api.telegram.org/bot{api_key}/{endpoint}'
    endpoint = base_api.format(api_key=self.config['api_key'], endpoint=endpoint)
    try:
        response = method(endpoint, data=kwargs.get('data', None), params=kwargs.get('params', {}), **self.config['requests_kwargs'])
        if (response.status_code != 200):
            raise ValueError('Got unexpected response. ({}) - {}'.format(response.status_code, response.text))
        return response.json()
    except Exception as e:
        return {'ok': False, 'error': str(e)}