{"id":19703608,"url":"https://github.com/phantominsights/reddit-bots","last_synced_at":"2025-04-29T14:30:56.540Z","repository":{"id":101907041,"uuid":"198915199","full_name":"PhantomInsights/reddit-bots","owner":"PhantomInsights","description":"A collection of Reddit bots that I use to enhance the subreddits I manage.","archived":false,"fork":false,"pushed_at":"2021-10-04T19:33:33.000Z","size":63,"stargazers_count":25,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T17:51:10.123Z","etag":null,"topics":["beautifulsoup","praw","python3","reddit-bot","requests","rss","web-scraper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PhantomInsights.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"agentphantom","patreon":"agentphantom"}},"created_at":"2019-07-25T23:44:48.000Z","updated_at":"2024-08-18T06:49:48.000Z","dependencies_parsed_at":"2023-03-13T15:25:05.221Z","dependency_job_id":null,"html_url":"https://github.com/PhantomInsights/reddit-bots","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhantomInsights%2Freddit-bots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhantomInsights%2Freddit-bots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhantomInsights%2Freddit-bots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PhantomInsights%2Freddit-bots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PhantomInsights","download_url":"https://codeload.github.com/PhantomInsights/reddit-bots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251518883,"owners_count":21602229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beautifulsoup","praw","python3","reddit-bot","requests","rss","web-scraper"],"created_at":"2024-11-11T21:18:24.578Z","updated_at":"2025-04-29T14:30:56.529Z","avatar_url":"https://github.com/PhantomInsights.png","language":"Python","funding_links":["https://github.com/sponsors/agentphantom","https://patreon.com/agentphantom","https://www.patreon.com/bePatron?u=20521425"],"categories":[],"sub_categories":[],"readme":"# Reddit Bots\n\nThis repository contains a collection of Reddit bots that I use to enhance my subreddits.\n\nThese bots have a few things in common, they all run on a `Raspberry Pi`, are scheduled with `crontab` and use the same config.py file. The bots have been tested with Raspbian Buster Lite which comes with Python 3.7.3 pre-installed.\n\nEach bot is separated into their own folder. Feel free to rearrange them as you need.\n\nTo prevent duplicate actions most bots keep a local log of their actions in a .txt file.\n\n## Requirements\n\nPython 3 is used to develop and test all the bots. The bots use the following libraries.\n\n* BeautifulSoup - Used to perform web scraping.\n* PRAW - Makes the use of the Reddit API very easy.\n* Requests - Used to make GET requests.\n* openpyxl - Used to read .xlsx files.\n\n## AutoPoster\n\nThis bot grabs the top 3 links from a Google News RSS feed and posts them to an specific subreddit.\n\nIt is scheduled to run every 6 hours.\n\n`0 */6 * * * cd /home/pi/Documents/autoposter \u0026\u0026 python3 bot.py`\n\n## FinanceBot\n\nThis bot grabs data from 2 websites, the first one it performs web scraping and gets 3 values from each currency pair it requests.\n\nFrom the other site it downloads 2 Excel files and extracts values from specified rows.\n\nThis bot works on both old and new Reddit. For old Reddit it updates the sidebar and for new Reddit it updates an specific sidebar text widget.\n\nNew Reddit widgets don't show their id's on the API so we need to iterate over all of them until we find the desired one.\n\nA sidebar.txt file is included which can contain your subreddit introduction, rules and other important information. The contents of this file are then appended with a `Markdown` table and a footer.\n\nIt is scheduled to run every 3 hours.\n\n`0 */3 * * * cd /home/pi/Documents/financebot \u0026\u0026 python3 bot.py`\n\n## CoronaBot\n\nThis bot reuses concepts from other bots, it was developed to show the latest information for the COVID-19 pandemic.\n\nIt reads a Google News RSS feed and grabs the first 15 links. It then gets information from Wikipedia using web scraping and fills a template with all this information.\n\nIt is scheduled to run every hour.\n\n`0 * * * * cd /home/pi/Documents/coronabot \u0026\u0026 python3 bot.py`\n\n## StickyBot\n\nThis bot creates discussion threads, stickies them and after a day it unstickies them.\n\nThe bot starts by reading the system arguments which are:\n\n* The file path\n* Action - sticky/unsticky\n* Day - monday/wednesday/friday\n\nFrom there it calls the respective function.\n\nI implemented  a simple templating system where the post text is read from a .txt file and then replaces placeholder variables, for example:\n\ntemplate_file.txt\n\n```\nHey there, today is %TODAY% this is some example post.\n```\n\nPython code\n\n```python\ntext = open(\"template_file.txt\").read().replace(\"%TODAY%\", today_variable)\n```\n\n\nCurrently there are 3 discussions:\n\n* Monday - This submission contains the 3 top posts from last week. It gets posted and stickied every Monday at 9 am and gets unsticked every Tuesday at 9 pm.\n* Wednesday - This submission takes a random politician from a predefined pool and asks the users what they thing about them. It gets posted and stickied every Wednesday at 9 am and gets unsticked every Thursday at 9 pm.\n* Friday - Casual discussion. It gets posted and stickied every Friday at 9 am and gets unsticked every Saturday at 9 pm.\n\n```\n0 9 * * 1 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py sticky monday\n0 21 * * 2 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py unsticky monday\n\n0 9 * * 3 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py sticky wednesday\n0 21 * * 4 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py unsticky wednesday\n\n0 9 * * 5 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py sticky friday\n0 21 * * 6 cd /home/pi/Documents/stickybot \u0026\u0026 python3 bot.py unsticky friday\n```\n\n## Conclusion\n\nEnhancing the features of the subreddits I manage with these bots has been a positive experience for me and their communities.\n\nI hope you find them useful and inspire you to create your own bots. Also feel free to use them on your own subreddits.\n\n[![Become a Patron!](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=20521425)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantominsights%2Freddit-bots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphantominsights%2Freddit-bots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphantominsights%2Freddit-bots/lists"}