This is a bot for ComfortDelGro Driving Centre to help you chope those hard-to-get sessions and speedrun your way to your license!
Features:
- Periodically fetch available sessions for Simulator, BTT, RTT, FTT, Practical Lesson, and Practical Test
- Automatically solves any CAPTCHAs
- Compare with booked dates for each available session
- Notify user (via Telegram & E-mail) if earlier session is found
- Attempt to reserve the session if possible
Full credit goes to cdc-helper by mfjkri where I forked this repository from. I refactored the code, added the ability to book Simulator sessions, fixed some bugs, and then some.
Recently, CDC has tried to clamp down on bots. If you are flagged for possible botting behaviour, they will disable the "Stored Value" of your account for 5 days, and you will only be able to log in to your account after that. I am not sure what they look at to determine if you are botting (e.g. number of requests per day, time between requests, CAPTCHAv3, etc.).
As I have already obtained my Class 3A license through the Standard team, I am unable to test and maintain the bot anymore as my account has been closed. I have tried to make it compatible with other licenses (e.g. Class 2B) and other teams (e.g. One Team, Elite Team), but there is no guarantee that it will work as I cannot test it.
However, feel free to fork the project and add more features! For instance,
- Vary the time between requests to avoid bot detection(?)
- Bot on the CDC app as CAPTCHA is currently not implemented there
- Ability to book specific sessions when available instead of just reserving them
- Support the booking of more types of sessions (e.g. Circuit Enhancement Practice, etc.)
If you do not already have Python 3, install it from the official website.
$ git clone https://github.com/Zhannyhong/cdc-bot.git
$ cd cdc-bot
On Linux/MacOS:
$ python3 -m venv venv
$ source venv/bin/activate
On Windows:
$ python3 -m venv venv
$ venv\Scripts\activate
$ pip install -r requirements.txt
Create config.yaml
from the template and fill in the required fields.
$ cp config.yaml.example config.yaml
This project uses a third party API that is unfortunately a paid service.
As of writing, the rates of using this API are relatively cheap (SGD$5 can last you for about a month of the program
runtime). To continue using this project, head over to 2captcha.com
- Create an account
- Top up your account with sufficient credits
- Copy your API Token and paste it into
config.yaml
If you wish to enable Email notifications:
- Set
email_notification_enabled
toTrue
- Set
smtp_server
andsmtp_port
accordingly (Default values are for gmail) - Set
smtp_user
to your email address - Set
smtp_pw
to your email account password (you may have to create an App password if your account has 2FA enabled; for gmail) - Set
recipient_address
to the email address to send notifications to (should be the same assmtp_user
)
If you wish to enable Telegram notifications:
- Set
telegram_notification_enabled
toTrue
(Already True by default) - Follow this guide to create your telegram bot
- Copy the API Token generated and paste it into
telegram_bot_token
- Send your bot
\start
on Telegram - Visit
https://api.telegram.org/botBOT_TOKEN/getUpdates
, replacingBOT_TOKEN
with your API Token from (3) - Send a test message to your bot on Telegram
- There should be a new entry in the JSON on the URL you opened from (5)
- Copy the chat ID from the JSON (result::[X]::message::chat::id) and paste it into
telegram_chat_id
- Fill in your CDC username and password under
username
andpassword
respectively - Set type in
monitored_types
toTrue
for the types you want the bot to be checking for
By default, the program will run every 30 minutes as that is the maximum duration CDC will keep a reservation. The program will not run from 3am to 6am as it is unlikely other people will cancel their bookings during that time, and the user will also likely be asleep and unable to book the session. This is to reduce requests to 2captcha.
Run the program from the working directory cdc-bot
so that the directories are in the correct path.
$ python src/main.py