smartel99

str comparaison problem

Jul 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. async def check_for_new_post(bot):
  2.     global subscriptions
  3.  
  4.     # TODO: Fetch data from file
  5.     # subscriptions = get_file()
  6.     # if subscriptions != 'None':
  7.  
  8.     await bot.wait_until_ready()
  9.     while not bot.is_closed:
  10.         for subscription in subscriptions:
  11.             sub = read_it_on_reddit.sub_exists(subscription.subreddit)
  12.             new_posts = read_it_on_reddit.get_newest_post(subscription.subreddit)
  13.  
  14.             for new_post in new_posts:
  15.                 if subscription.old_post != new_post.fullname:
  16.                     subscription = subscription._replace(old_post=new_post.fullname)
  17.                     print("old: " + subscription.old_post, type(subscription.old_post), " New: ", new_post.fullname,
  18.                           type(new_post.fullname))
  19.                     await bot.send_message(subscription.channel,
  20.                                            embed=read_it_on_reddit.create_embed("New post from:", new_post, sub))
  21.         await asyncio.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment