# Buggy code
async def connect(self):
    """Connect to Telegram.

    This method is not an authorization call. It basically
    checks if the API token was provided and makes an API
    call to Telegram and evaluates the status of the call.

    """
    _LOGGER.debug("Connecting to telegram")
    async with aiohttp.ClientSession() as session:
        resp = await session.get(self.build_url("getMe"))

        if resp.status != 200:
            _LOGGER.error("Unable to connect")
            _LOGGER.error("Telegram error %s, %s", resp.status, resp.text)
        else:
            json = await resp.json()
            _LOGGER.debug(json)
            _LOGGER.debug("Connected to telegram as %s", json["result"]["username"])


# Traceback (KeyError)
DEBUG opsdroid.connector.telegram: {'update_id': 539000683, 'channel_post': {'message_id': 15, 'chat': {'id': -1002528219498, 'title': 'vLab', 'type': 'channel'}, 'date': 1550000742, 'text': 'hi'}}
DEBUG opsdroid.connector.telegram: {'update_id': 539026984, 'message': {'message_id': 53, 'from': {'id': 452280388, 'is_bot': False, 'first_name': 'IOBreaker', 'language_code': 'en'}, 'chat': {'id': 452266388, 'first_name': 'IOBreaker', 'type': 'private'}, 'date': 1550000813, 'text': '/start', 'entities': [{'offset': 0, 'length': 6, 'type': 'bot_command'}]}}
DEBUG asyncio: Using selector: EpollSelector
Traceback (most recent call last):
File "/usr/bin/opsdroid", line 11, in <module>
load_entry_point('opsdroid==0.14.1', 'console_scripts', 'opsdroid')()
File "/usr/lib64/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib64/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib64/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib64/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/opsdroid/__main__.py", line 197, in main
opsdroid.run()
File "/usr/lib/python3.6/site-packages/opsdroid/core.py", line 135, in run
self.eventloop.run_until_complete(asyncio.gather(*pending))
File "/usr/lib64/python3.6/asyncio/base_events.py", line 473, in run_until_complete
return future.result()
File "/usr/lib/python3.6/site-packages/opsdroid/connector/telegram/__init__.py", line 163, in listen
await self._get_messages()
File "/usr/lib/python3.6/site-packages/opsdroid/connector/telegram/__init__.py", line 143, in _get_messages
await self._parse_message(json)
File "/usr/lib/python3.6/site-packages/opsdroid/connector/telegram/__init__.py", line 99, in _parse_message
user = result["message"]["from"]["username"]
KeyError: 'username'

# Fixed code
async def connect(self):
    """Connect to Telegram.

    This method is not an authorization call. It basically
    checks if the API token was provided and makes an API
    call to Telegram and evaluates the status of the call.

    """
    _LOGGER.debug("Connecting to telegram")
    self.session = aiohttp.ClientSession()
    resp = await self.session.get(self.build_url("getMe"))

    if resp.status != 200:
        _LOGGER.error("Unable to connect")
        _LOGGER.error("Telegram error %s, %s", resp.status, resp.text)
    else:
        json = await resp.json()
        _LOGGER.debug(json)
        _LOGGER.debug("Connected to telegram as %s", json["result"]["username"])