kopia lustrzana https://github.com/fabston/TradingView-Webhook-Bot
Updated encoding for Telegram Messages
rodzic
025dbcc58d
commit
8a2a5c80b5
|
@ -15,9 +15,9 @@ def send_alert(data):
|
|||
if config.send_telegram_alerts:
|
||||
tg_bot = Bot(token=config.tg_token)
|
||||
try:
|
||||
tg_bot.sendMessage(data['telegram'], data['msg'].replace('_', '\_'), parse_mode='MARKDOWN')
|
||||
tg_bot.sendMessage(data['telegram'], data['msg'].encode('latin-1','backslashreplace').decode('unicode_escape'), parse_mode='MARKDOWN')
|
||||
except KeyError:
|
||||
tg_bot.sendMessage(config.channel, data['msg'].replace('_', '\_'), parse_mode='MARKDOWN')
|
||||
tg_bot.sendMessage(config.channel, data['msg'].encode('latin-1','backslashreplace').decode('unicode_escape'), parse_mode='MARKDOWN')
|
||||
except Exception as e:
|
||||
print('[X] Telegram Error:\n>', e)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue