Inspiration
Discord Bot powered by MagicEden as a service.
Serverless functions allow anyone to access providing a lot of flexibility with customization. They scale horizontally, are cost efficient (pay as you use) and can be easily integrated with other Cloud Services (eg. Cloud Scheduler) and have built in features like logging, error detection, etc.
Similar to how MagicEden has followed the Web3-way of transparency in data via the API, I thought it'd be interesting to build something that enables openness for Discord bots.
This discord bot returns real-time data for any NFT project on MagicEden, and can be used to relay information to any discord server with proper webhook integration.
You can think of this as 1 prebuild discord bot template powered by MagicEden, enabling developers/non-technical users to easily integrate and retrieve data to provide value to their community.
What it does
main.py
Script containing the Cloud Function and logic needed to create a discord message.This discord bot returns statistics on a certain NFT project (eg. floor price, avg listed price, etc.), as well as provides visualization capabilities to quickly understand distribution of current listings.
me_api
Python SDK (semi-built out) for MagicEden API to help with development lifecycle.
Example Usage
import me_api
remnants = me_api.floorcheckr.Collections("the_remnants_")
remnants.get_sellers_distribution() # returns the seller wallet_id and # of Remnants NFTs they have listed (eg. are there whales selling)
remnants.get_listed_count() # returns # of actively listed Remnants NFTs on MagicEden
remnants.get_sale_activities() # returns all the purchase activity for Remnants within the last 24 hours
remnants.get_median_listing_price() # return median price of listed Remnants NFT
remnants.get_price_distribution() #returns price and # count listed sorted by price
remnants.get_price_distribution(sort="count") #returns price and # count listed sorted by count
How we built it
- Python to retrieve data from ME API
- Seaborn + Matplotlib to create visualization
- Discordpy to send message to discord channel
- GCP Cloud Function to host the script on the cloud
Challenges we ran into
- Good way structure SDK (making easy to use for even non-technical users)
- Formatting of Discord Embed Messaging (eg. inline vs not inline)
Accomplishments that we're proud of
- Being able to output an image programmatically and embedding into a discord message during run-time (leverage Cloud Function's
/tmpdirectory) - Developing a SDK that's user-friendly
What we learned
- Pros/Cons of ME's API (eg. pro: great for real-time/listing endpoints | con: not so great for historical analysis, activities endpoint limited to 24 hours)
- Serverless Function + Discord Integration (logging, troubleshooting, etc.)
What's next for MagicEden FloorCheckr
- Implement restrictions on who could hit the function (maybe only valid ME api keys are able to use)
- Develop more NFT Analytic Discord Bot Templates and make them customizable.
- Better visualizations (remove outliers to make chart more useful)
- Complete
me_apisdk and publish onto pip
FloorCheckr is just one of many publicly accessible discord bot endpoints that's powered by MagicEden's API, that projects can integrate to provide value to their users
Feel free to try it out!
import requests
def floorcheckr_public(symbol: str, webhook_url: str):
data = {"symbol": symbol,
"webhook_url": webhook_url}
url = "https://us-central1-serverless-344401.cloudfunctions.net/floorcheckr"
return (requests.post(url, json=data).json())
Built With
- gcp
- magiceden-api
- matplotlib
- python
- seaborn
- serverless-functions
Log in or sign up for Devpost to join the conversation.