From 294cf72aad469b3faed5b6708fbe8e3f50108e7e Mon Sep 17 00:00:00 2001 From: Magic <82341152+MagicTheDev@users.noreply.github.com> Date: Sun, 14 Jul 2024 12:33:02 -0500 Subject: [PATCH] add: reddit comment tracking --- .idea/workspace.xml | 20 +++++++++++--------- bot/reddit/track.py | 9 +++++---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6018dad..2f2c650 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,6 +6,8 @@ + + diff --git a/bot/reddit/track.py b/bot/reddit/track.py index 6a5150d..7873015 100644 --- a/bot/reddit/track.py +++ b/bot/reddit/track.py @@ -68,18 +68,19 @@ async def comment_stream(reddit: asyncpraw.Reddit): logger.error(str(e)) continue - -async def main(): +async def create_reddit(): secret = getenv("REDDIT_SECRET") RPW = getenv("REDDIT_PW") - - reddit = asyncpraw.Reddit( + return asyncpraw.Reddit( client_id="-dOCgLIHqUJK7g", client_secret=secret, username="Powerful-Flight2605", password=RPW, user_agent="Reply Recruit" ) + +async def main(): + reddit = await create_reddit() loop = asyncio.get_event_loop() loop.create_task(comment_stream(reddit)) loop.create_task(post_stream(reddit))