don't import python-telegram-bot at runtime if disabled in config

This commit is contained in:
gcarq
2018-06-08 23:50:38 +02:00
parent 4048859912
commit 3787dad212
4 changed files with 15 additions and 13 deletions

View File

@@ -5,7 +5,6 @@ import logging
from typing import List
from freqtrade.rpc.rpc import RPC
from freqtrade.rpc.telegram import Telegram
logger = logging.getLogger(__name__)
@@ -21,6 +20,7 @@ class RPCManager(object):
# Enable telegram
if freqtrade.config['telegram'].get('enabled', False):
logger.info('Enabling rpc.telegram ...')
from freqtrade.rpc.telegram import Telegram
self.registered_modules.append(Telegram(freqtrade))
def cleanup(self) -> None:

View File

@@ -16,6 +16,8 @@ from freqtrade.rpc.rpc import RPC, RPCException
logger = logging.getLogger(__name__)
logger.debug('Included module rpc.telegram ...')
def authorized_only(command_handler: Callable[[Any, Bot, Update], None]) -> Callable[..., Any]:
"""