messagehandler.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:notipy-server 作者: michaelimfeld 项目源码 文件源码
def get_telegram_bot():
    """
    Creates a telegram bot instance.

    Returns:
        telegram.Bot: The bot instance.

    Raises:
        TelegramConfigurationError: If the telegram bot was not properly
            configured.
    """
    logger = logging.getLogger()
    try:
        return Bot(Config().telegram_token)
    except (FileNotFoundError, ValueError, TelegramError) as exc:
        logger.error("Telegram token not present or invalid: '%s'", str(exc))
        raise TelegramConfigurationError("Telegram token not "
                                         "present or invalid.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号