A custom Solana NFT Twitter sales bot written in Python. Incorporate currencies, Solana price, exchange links, etc.
This bot allows for custom tweet text and fast response times. The bot utilizes MagicEden's GET/collections/:symbol/activities
API call, responding to sales allowing for NFT image uploading and metadata access through MagicEden's API. This bot is designed to run on an external server. This bot was tested on an EC2 AWS instance and a Raspberry Pi 4. Usable on Unix based servers.
After installing python3, clone and install Python requirements with
git clone https://github.com/0xRoxas/Twitter-Solana-NFT-Sales-Bot.git
cd Twitter-Solana-NFT-Sales-Bot
pip install -r requirements.txt
A collection's symbol can be found by going to https://magiceden.io/ and searching for your collection's marketplace page (click the search bar). Look at the url and copy the text appearing directly after the last dash following "marketplace" as highlighted above. This text is your collection's symbol, this is needed for the bot to know what collection to tweet out. Paste this value in the ./config/config.json attribute called ME_symbol as seen here.
A. Make a Twitter account and sign up to become a Twitter developer here.
B. Make sure your Twitter developer account has elevated access for image uploading here.
C. Make sure that the Access Token and Secret has been created with Read and Write permissions.
D. Place your Twitter developer credentials in ./config/config.json as seen here.
Run with
python3 bot.py
Or recommended with (if you do not want an ssh exit or general exit to halt the bot)
nohup python3 bot.py &
Please give the bot a few minutes to receive sales.
The config file ./config/config.json will look something like this:
{
"ME_symbol": "ADD_YOUR_SYMBOL_HERE",
"twitter_credentials": {
"bearer_token": "ADD_YOURS_HERE",
"consumer_key": "ADD_YOURS_HERE",
"consumer_secret": "ADD_YOURS_HERE",
"access_token": "ADD_YOURS_HERE",
"access_token_secret": "ADD_YOURS_HERE"
},
"tweet_text": "BOOM💥 [-n] just sold for [-p] ([-f])",
"fiat_currency": "USD",
"TPS": 2,
"refresh_delay": 0.1,
"activities_per_call": 1000,
"use_img_on_chain": false
}
tweet_text: You can customize the text that is tweeted out with the NFT image. Tweet text follows this notation (the bot will replace the following syntax with ...):
Ex 1. (hypothetical data),
BOOM💥 [-n] just sold for [-p] ([-f])
would become
BOOM💥 SolGod #1 just sold for 50.24 SOL ($5000.37 USD)
Ex 2. (hypothetical data),
💥 [-n] SOLD for [-p] SOL ([-f])\n\n→ https://magiceden.io/item-details/[-m]"
would become
💥 SolGod #1 SOLD for 50.24 SOL ($5000.37 USD)
→ https://magiceden.io/item-details/FBoEv5Xt4fKSwPhVPt5t3HXptByesbtDWnCzE6DYe4Ys
fiat_currency: The bot currently supports the following currencies: EUR, USD, CAD, JPY, GPB, AUD, CNY, INR. Change this value to change the currency in which Solana is converted if you choose to output fiat price.
use_img_on_chain: By default in case the NFT image is greater than 3mb (Twitter will not allow) the bot uses the compressed image file from MagicEden's CDN (use_img_on_chain
== False). Change use_img_on_chain
to True if you would like to use the raw image stored on ipfs, arweave, etc. Note: In the rare case that your raw NFT file sizes are greater than 3mb, they will have to be compressed prior to being uploaded. Please see the comment <#compress here> in the send_tweet function - place your function that compresses the tmp
file there. For standard image files there are many resources online for python compression. For gifs, this gist may be of help.
This bot is 100% free to use. Use of this bot for your project is encouraged. No credit is needed.