kopia lustrzana https://github.com/fabston/TradingView-Webhook-Bot
Config: send alerts fix
rodzic
d3f46f83da
commit
ac956c1d89
|
@ -12,21 +12,21 @@ import smtplib, ssl
|
|||
from email.mime.text import MIMEText
|
||||
|
||||
def send_alert(data):
|
||||
if config.telegram:
|
||||
if config.send_telegram_alerts:
|
||||
try:
|
||||
tg_bot = Bot(token=config.tg_token)
|
||||
tg_bot.sendMessage(config.channel, data, parse_mode = 'MARKDOWN')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if config.discord:
|
||||
if config.send_discord_alerts:
|
||||
try:
|
||||
discord_alert = DiscordWebhook(url=config.discord_webhook, content=data)
|
||||
response = discord_alert.execute()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if config.twitter:
|
||||
if config.send_twitter_alerts:
|
||||
tw_auth = tweepy.OAuthHandler(config.tw_ckey, config.tw_csecret)
|
||||
tw_auth.set_access_token(config.tw_atoken, config.tw_asecret)
|
||||
tw_api = tweepy.API(tw_auth)
|
||||
|
@ -35,7 +35,7 @@ def send_alert(data):
|
|||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
if config.email:
|
||||
if config.send_email_alerts:
|
||||
try:
|
||||
email_msg = MIMEText(data)
|
||||
email_msg['Subject'] = config.email_subject
|
||||
|
|
Ładowanie…
Reference in New Issue