Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def check_for_new_post(bot):
- global subscriptions
- # TODO: Fetch data from file
- # subscriptions = get_file()
- # if subscriptions != 'None':
- await bot.wait_until_ready()
- while not bot.is_closed:
- for subscription in subscriptions:
- sub = read_it_on_reddit.sub_exists(subscription.subreddit)
- new_posts = read_it_on_reddit.get_newest_post(subscription.subreddit)
- for new_post in new_posts:
- if subscription.old_post != new_post.fullname:
- subscription = subscription._replace(old_post=new_post.fullname)
- print("old: " + subscription.old_post, type(subscription.old_post), " New: ", new_post.fullname,
- type(new_post.fullname))
- await bot.send_message(subscription.channel,
- embed=read_it_on_reddit.create_embed("New post from:", new_post, sub))
- await asyncio.sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment