From 35838f5e64fca3c28c520094ea90afd2b54104d8 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Sat, 21 Oct 2017 11:07:29 +0300 Subject: [PATCH 1/2] upgrade to latest telegram lib --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index be3a292f0..3483bc50e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -e git+https://github.com/ericsomdahl/python-bittrex.git@d7033d0#egg=python-bittrex SQLAlchemy==1.1.14 -python-telegram-bot==8.0 +python-telegram-bot==8.1.1 arrow==0.10.0 requests==2.18.4 urllib3==1.22 diff --git a/setup.py b/setup.py index e89fd2eee..eced2b5b3 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ setup(name='freqtrade', install_requires=[ 'python-bittrex==0.1.3', 'SQLAlchemy==1.1.13', - 'python-telegram-bot==8.0', + 'python-telegram-bot==8.1.1', 'arrow==0.10.0', 'requests==2.18.4', 'urllib3==1.22', From d32ff3410cc0de9dd9b29f1d7c950ebef8adb01a Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Sat, 21 Oct 2017 11:08:08 +0300 Subject: [PATCH 2/2] add help command to telegram bot --- freqtrade/rpc/telegram.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 5312125ed..4b320eb85 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -45,6 +45,7 @@ def init(config: dict) -> None: CommandHandler('stop', _stop), CommandHandler('forcesell', _forcesell), CommandHandler('performance', _performance), + CommandHandler('help', _help), ] for handle in handles: _updater.dispatcher.add_handler(handle) @@ -301,6 +302,27 @@ def _performance(bot: Bot, update: Update) -> None: send_msg(message, parse_mode=ParseMode.HTML) +@authorized_only +def _help(bot: Bot, update: Update) -> None: + """ + Handler for /help. + Show commands of the bot + :param bot: telegram bot + :param update: message update + :return: None + """ + message = """ +*/start:* `Starts the trader` +*/stop:* `Stops the trader` +*/status:* `Lists all open trades` +*/profit:* `Lists cumulative profit from all finished trades` +*/forcesell :* `Instantly sells the given trade, regardless of profit` +*/performance:* `Show performance of each finished trade grouped by pair` +*/help:* `This help message` + """ + send_msg(message, bot=bot) + + def send_msg(msg: str, bot: Bot = None, parse_mode: ParseMode = ParseMode.MARKDOWN) -> None: """ Send given markdown message