use dict as argument for rpc.send_msg
This commit is contained in:
@@ -61,7 +61,7 @@ class RPC(object):
|
||||
""" Cleanup pending module resources """
|
||||
|
||||
@abstractmethod
|
||||
def send_msg(self, msg: str) -> None:
|
||||
def send_msg(self, msg: Dict[str, str]) -> None:
|
||||
""" Sends a message to all registered rpc modules """
|
||||
|
||||
def _rpc_trade_status(self) -> List[Dict]:
|
||||
|
@@ -2,7 +2,7 @@
|
||||
This module contains class to manage RPC communications (Telegram, Slack, ...)
|
||||
"""
|
||||
import logging
|
||||
from typing import List
|
||||
from typing import List, Dict
|
||||
|
||||
from freqtrade.rpc.rpc import RPC
|
||||
|
||||
@@ -32,11 +32,14 @@ class RPCManager(object):
|
||||
mod.cleanup()
|
||||
del mod
|
||||
|
||||
def send_msg(self, msg: str) -> None:
|
||||
def send_msg(self, msg: Dict[str, str]) -> None:
|
||||
"""
|
||||
Send given markdown message to all registered rpc modules
|
||||
:param msg: message
|
||||
:return: None
|
||||
Send given message to all registered rpc modules.
|
||||
A message consists of one or more key value pairs of strings.
|
||||
e.g.:
|
||||
{
|
||||
'status': 'stopping bot'
|
||||
}
|
||||
"""
|
||||
logger.info('Sending rpc message: %s', msg)
|
||||
for mod in self.registered_modules:
|
||||
|
@@ -4,7 +4,7 @@
|
||||
This module manage Telegram communication
|
||||
"""
|
||||
import logging
|
||||
from typing import Any, Callable
|
||||
from typing import Any, Callable, Dict
|
||||
|
||||
from tabulate import tabulate
|
||||
from telegram import Bot, ParseMode, ReplyKeyboardMarkup, Update
|
||||
@@ -110,9 +110,9 @@ class Telegram(RPC):
|
||||
"""
|
||||
self._updater.stop()
|
||||
|
||||
def send_msg(self, msg: str) -> None:
|
||||
def send_msg(self, msg: Dict[str, str]) -> None:
|
||||
""" Send a message to telegram channel """
|
||||
self._send_msg(msg)
|
||||
self._send_msg('*Status:* `{status}`'.format(**msg))
|
||||
|
||||
@authorized_only
|
||||
def _status(self, bot: Bot, update: Update) -> None:
|
||||
|
Reference in New Issue
Block a user