A Cardano NFT Twitter bot that monitors sales for the Raging Teens Clan collection. It pulls and monitors data from OpenCNFT and posts any new sales on Twitter. The bot was created with Python 3.10 and has low requirements to allow anyone to download and modify it for their usage.
This is a simple Twitter sales bot that I started working on before splitting off to create the CNFT Sales Twitter Bot. The main difference here is this bot can easily take more than one Cardano NFT project. The CNFT Sales Twitter Bot is much simpler than this bot.
- A Twitter developer account - Will require Elevated Access for full twitter functions.
- Python 3.10 and basic knowledge of Python
- The Policy ID of the CNFT project
- Libraries required in requriements.txt
- Tweepy: Twitter actions
- Requests: GET data from OpenCNFT
- Ratelimit: Respect API
- PyCoingecko: Real-time Crypto prices
- Pillow: Image manipulation
The core logic behind the bot is upon the first start, it will check to see if you have a local file on the computer that contains previous tweet information. If no file is made, it will create one with the newest posting and begin the monitor.
- The main program is running on a While loop, and the core function is compare_listings which takes a project name and a file that is saved locally which contains the last tweeted information.
- You need to just enter the policy id for the CNFT project you are trying to monitor. I have policy ids saved in a .env file but you can hard-code a policy id. You can find the shortcut in the retrieve_sales function.
- The Twitter posting function, tweet_sale, can modify the payload message easily.
- This will work exclusively for Cardano NFTs. For other NFTs, a bit of the logic must be changed.