Countle is the home for countdowns. The site was created for the timezone bot to host countdowns for it. The timezone bot and Countle together make it easier to know when a certain event happens. In the Internet people use different timezones and live in different areas. It's difficult to change times to different timezones and take into account daylight savings etc. Which is why I created Countle and Timezone bot, to make it easier.
/u/the_timezone_bot is a Reddit bot that parses new posts and comments looking for times with timezones. The bot then tries to make sure that the found time is for today and not for some other date. After that it calculates the difference between the found time and current time. Posts a comment with the time difference and a link to this website where people can see the active countdown.
The timezone bot works by utilizing the Reddit API. The bot goes through every new post and comment that is posted to Reddit, or it tries to. Obviously the Reddit API has some rate limits so it's not possible to go through every post and comment.
The Bot goes through the post title and body looking first for a time and timezone, for this purpose it uses regex. It looks for the most common time formats for example 9 PM CEST. If the bot founds something it tries to parse the time and timezone to verify it really is time. For this it utilizes python module dateutil and parser. If it returns datetime everything is good, if not it stops and continues to next post/comment. Also before this it has made sure that the subreddit is not in the "don't post" list, all subreddits don't want bots and we have to respect that.
Now the time is verified to be a real. Now it's time to make sure the time was meant as event start time or something that could benefit from timezone bot posting a comment. Also we want that the time happens in the future, it's no use to tell when yesterday happens. For this it for example uses regex to find dates to get better view when exactly it happens and also looks for some keyword like yesterday.
At this point the found time has passed all the tests and the bot is confident that the time happens in the future and that it would be helpful to tell everyone how long till this time happens. Then it calls the Countle.com API and creates new countdown. Now everything is ready and it composes the message and finally posts the comment.