# Buggy code
def __init__(self, config, opsdroid=None):
    """Create the connector.

    Args:
        config (dict): configuration settings from the
            file config.yaml.

    """
    _LOGGER.debug("Loaded telegram connector")
    super().__init__(config, opsdroid=opsdroid)
    self.name = "telegram"
    self.opsdroid = opsdroid
    self.latest_update = None
    self.default_room = None
    self.listening = True
    self.default_user = config.get("default-user", None)
    self.whitelisted_users = config.get("whitelisted-users", None)
    self.update_interval = config.get("update_interval", 1)

    try:
        self.token = config["token"]
    except (KeyError, AttributeError):
        _LOGGER.error(
            "Unable to login: Access token is missing. "
            "Telegram connector will be unavailable."
        )


# 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
def __init__(self, config, opsdroid=None):
    """Create the connector.

    Args:
        config (dict): configuration settings from the
            file config.yaml.

    """
    _LOGGER.debug("Loaded telegram connector")
    super().__init__(config, opsdroid=opsdroid)
    self.name = "telegram"
    self.opsdroid = opsdroid
    self.latest_update = None
    self.default_room = None
    self.listening = True
    self.default_user = config.get("default-user", None)
    self.whitelisted_users = config.get("whitelisted-users", None)
    self.update_interval = config.get("update_interval", 1)
    self.session = None
    self._closing = asyncio.Event()
    self.loop = asyncio.get_event_loop()

    try:
        self.token = config["token"]
    except (KeyError, AttributeError):
        _LOGGER.error(
            "Unable to login: Access token is missing. "
            "Telegram connector will be unavailable."
        )