Update telegram.py
Implemented named unicode, to support all platforms
This commit is contained in:
parent
a5119104d0
commit
a86d4a99fc
@ -58,6 +58,11 @@ def authorized_only(command_handler: Callable[..., None]) -> Callable[..., Any]:
|
||||
|
||||
class Telegram(RPC):
|
||||
""" This class handles all telegram communication """
|
||||
'🔵'.encode('ascii', 'namereplace')
|
||||
'🚀'.encode('ascii', 'namereplace')
|
||||
'✳'.encode('ascii', 'namereplace')
|
||||
'❌'.encode('ascii', 'namereplace')
|
||||
'⚠'.encode('ascii', 'namereplace')
|
||||
|
||||
def __init__(self, freqtrade) -> None:
|
||||
"""
|
||||
@ -133,7 +138,7 @@ class Telegram(RPC):
|
||||
else:
|
||||
msg['stake_amount_fiat'] = 0
|
||||
|
||||
message = ("🔵 *{exchange}:* Buying {pair}\n"
|
||||
message = ("\N{LARGE BLUE CIRCLE} *{exchange}:* Buying {pair}\n"
|
||||
"*Amount:* `{amount:.8f}`\n"
|
||||
"*Open Rate:* `{limit:.8f}`\n"
|
||||
"*Current Rate:* `{current_rate:.8f}`\n"
|
||||
@ -144,7 +149,7 @@ class Telegram(RPC):
|
||||
message += ")`"
|
||||
|
||||
elif msg['type'] == RPCMessageType.BUY_CANCEL_NOTIFICATION:
|
||||
message = "⚠ *{exchange}:* Cancelling Open Buy Order for {pair}".format(**msg)
|
||||
message = "\N{WARNING SIGN} *{exchange}:* Cancelling Open Buy Order for {pair}".format(**msg)
|
||||
|
||||
elif msg['type'] == RPCMessageType.SELL_NOTIFICATION:
|
||||
msg['amount'] = round(msg['amount'], 8)
|
||||
@ -154,16 +159,16 @@ class Telegram(RPC):
|
||||
msg['duration_min'] = msg['duration'].total_seconds() / 60
|
||||
|
||||
if float(msg['profit_percent']) >= 0.0:
|
||||
message = "✳ *{exchange}:* Selling {pair}\n"
|
||||
message = "\N{EIGHT SPOKED ASTERISK} *{exchange}:* Selling {pair}\n"
|
||||
|
||||
elif float(msg['profit_percent']) > 5.0:
|
||||
message = ("🚀 *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
message = ("\N{ROCKET} *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
|
||||
elif msg['sell_reason'] == "stop_loss":
|
||||
message = ("⚠ *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
message = ("\N{WARNING SIGN} *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
|
||||
else:
|
||||
message = ("❌ *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
message = ("\N{CROSS MARK} *{exchange}:* Selling {pair}\n").format(**msg)
|
||||
|
||||
message += ("*Amount:* `{amount:.8f}`\n"
|
||||
"*Open Rate:* `{open_rate:.8f}`\n"
|
||||
@ -183,14 +188,14 @@ class Telegram(RPC):
|
||||
' / {profit_fiat:.3f} {fiat_currency})`').format(**msg)
|
||||
|
||||
elif msg['type'] == RPCMessageType.SELL_CANCEL_NOTIFICATION:
|
||||
message = ("⚠ *{exchange}:* Cancelling Open Sell Order "
|
||||
message = ("\N{WARNING SIGN} *{exchange}:* Cancelling Open Sell Order "
|
||||
"for {pair}. Reason: {reason}").format(**msg)
|
||||
|
||||
elif msg['type'] == RPCMessageType.STATUS_NOTIFICATION:
|
||||
message = '*Status:* `{status}`'.format(**msg)
|
||||
|
||||
elif msg['type'] == RPCMessageType.WARNING_NOTIFICATION:
|
||||
message = '⚠ *Warning:* `{status}`'.format(**msg)
|
||||
message = '\N{WARNING SIGN} *Warning:* `{status}`'.format(**msg)
|
||||
|
||||
elif msg['type'] == RPCMessageType.CUSTOM_NOTIFICATION:
|
||||
message = '{status}'.format(**msg)
|
||||
|
Loading…
Reference in New Issue
Block a user