Telegram-powered bot that listens for posted deals and notifies users when certain keywords are met.
In order to get this bot to work, you'll need the following things:
- Telegram Bot ID
- Default Telegram Chat ID
- Reddit Account Username
- Reddit Account Password
- Reddit API Client ID
- Reddit API Client Secret
- Open your Telegram app and start a new chat with @Botfather.
- Send "/newbot"
- Follow the steps until @Botfather tells you "Done!"
- Copy the token provided in that message and paste it in
check_for_deals.pyas the value forself.BOT_ID - If at any time you forget this token and need it again, message @Botfather and send "/token"
- Start a group chat with your new bot.
- Send a message to the group chat while your bot is present.
- Navigate to https://api.telegram.org/bot<BOT_TOKEN_YOU_GOT_FROM_THE_ABOVE_STEPS>/getUpdates
- In the JSON response that comes back, you should see
"chat": { "id": "..." - Copy that ID and paste it in
check_for_deals.pyas the value forself.CHAT_ID.
- Go to reddit and either create a new account for your bot or use an existing one.
- Set the username in
check_for_deals.pyas the value forusernamein the Reddit constructor (line 28). - IMPORTANT: This script will listen on whatever subreddits the chosen account is subscribed to. If you want to make it work as intended, make sure you are subscribed to the following subreddits:
- /r/deals
- /r/gamedeals
- /r/steamdeals
- /r/buildapcsales
- /r/frugalmalefashion
- /r/computerdeals
- /r/dealsreddit
- /r/amazonspecials
- /r/toolsales
- /r/nintendoswitchdeals
- /r/pcpartsales
- Set the password for the chosen account in
check_for_deals.pyas the value forpasswordin the Reddit constructor (line 26).
- Go to https://www.reddit.com/prefs/apps while logged in as the account chosen for your bot.
- Click the button to create an app.
- Fill out the fields. "Personal Use Script", I believe, best describes this bot.
- Once done, copy the value underneath the name of the app and paste it in
check_for_deals.pyas the value forclient_idin the Reddit constructor (line 24)
- Copy the value next to "secret" for your app on https://www.reddit.com/prefs/apps and paste it in
check_for_deals.pyas the value forclient_secretin the Reddit constructor (line 25).
Once you've completed the setup, all you need to do is run the script. This script is setup to run on Python 3+ in a Linux environment. For Windows, there is one minor adjustment that needs to be made:
- Remove the shebang on the first line (
#!/usr/bin/python3). It's not needed for Windows.
If you have any suggestions or questions, contact /u/kn0wmad1c by emailing matt at formica dot dev.