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 idx, subscription in enumerate(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 subscriptions[idx].old_post != new_post.fullname:
- subscriptions[idx] = subscriptions[idx]._replace(old_post=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(1)
Advertisement
Add Comment
Please, Sign In to add comment