From ec4c9c0063d8c94879f8538808fa0344b772b52e Mon Sep 17 00:00:00 2001 From: runo280 Date: Sat, 18 Jan 2020 10:11:56 +0330 Subject: [PATCH] Mark as sent if publish was successful --- bot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 180b6b9..578a469 100644 --- a/bot.py +++ b/bot.py @@ -11,5 +11,12 @@ title = x['title'] link = x['link'] date = x['date'] - telegram.send_article(title, link, date) - db.feeds.update_one({'link': link}, set_published_query) + send = telegram.send_article(title, link, date) + result = send.json() + if result['ok'] is True: + print('ok') + db.feeds.update_one({'link': link}, set_published_query) + else: + print('failed to publish') + +