Merge pull request #77 from gcarq/help-command

Help command to Telegram bot
This commit is contained in:
Michael Egger 2017-10-21 13:51:08 +02:00 committed by GitHub
commit 96790d50e5
3 changed files with 24 additions and 2 deletions

View File

@ -45,6 +45,7 @@ def init(config: dict) -> None:
CommandHandler('stop', _stop), CommandHandler('stop', _stop),
CommandHandler('forcesell', _forcesell), CommandHandler('forcesell', _forcesell),
CommandHandler('performance', _performance), CommandHandler('performance', _performance),
CommandHandler('help', _help),
] ]
for handle in handles: for handle in handles:
_updater.dispatcher.add_handler(handle) _updater.dispatcher.add_handler(handle)
@ -301,6 +302,27 @@ def _performance(bot: Bot, update: Update) -> None:
send_msg(message, parse_mode=ParseMode.HTML) 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 <trade_id>:* `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: def send_msg(msg: str, bot: Bot = None, parse_mode: ParseMode = ParseMode.MARKDOWN) -> None:
""" """
Send given markdown message Send given markdown message

View File

@ -1,6 +1,6 @@
-e git+https://github.com/ericsomdahl/python-bittrex.git@d7033d0#egg=python-bittrex -e git+https://github.com/ericsomdahl/python-bittrex.git@d7033d0#egg=python-bittrex
SQLAlchemy==1.1.14 SQLAlchemy==1.1.14
python-telegram-bot==8.0 python-telegram-bot==8.1.1
arrow==0.10.0 arrow==0.10.0
requests==2.18.4 requests==2.18.4
urllib3==1.22 urllib3==1.22

View File

@ -17,7 +17,7 @@ setup(name='freqtrade',
install_requires=[ install_requires=[
'python-bittrex==0.1.3', 'python-bittrex==0.1.3',
'SQLAlchemy==1.1.13', 'SQLAlchemy==1.1.13',
'python-telegram-bot==8.0', 'python-telegram-bot==8.1.1',
'arrow==0.10.0', 'arrow==0.10.0',
'requests==2.18.4', 'requests==2.18.4',
'urllib3==1.22', 'urllib3==1.22',