Text based countdown timer for a subreddit's sidebar to help Reddit communities to count down to important events.
Based on the code from matchu/reddit-countdown
- Python 3.8 or above
- praw (Python Reddit API Wrapper)
-
Create an app on Reddit (https://www.reddit.com/prefs/apps/). You just need to enter
name
&redirect uri
. Use http://127.0.0.1 as redirect uri. -
You will get a client id & secret that you will use below.
-
If you are using a separate Bot account (recommended), it should have
Manage Settings
access. -
In the cloned repository, copy countdown.ini.sample to countdown.ini.
- Give a name to reference your bot (YourBotName).
- Specify your subreddit.
- Name of the sidebar where you want the countdown.
- Specify a target time. It will be in UTC.
-
Copy praw.ini.sample to praw.ini.
- Replace the section heading with YourBotName.
- Enter the client id & secret you received when creating the app
- Enter your Reddit username and password
- Specify a meaningful user agent. Check Reddit API Rules for rules.
-
In the sidebar, create a text widget with the name you mentioned above.
-
Enter the placeholder as below:
There are some days, some hours, some minutes, and some seconds remaining.
-
Run your script.
python countdown.py
-
It will update the widget content replacing the placeholders.
-
Setup a job to run the script at regular intervals.
- It works with Markup text. Not tested with HTML content.
- Might work in lower Python 3.x versions.