A bot that shares new OpenSea events for a collection to Discord and Twitter.
A bot that shares new OpenSea events for a collection to Discord and Twitter.
Designed to handle multiple output configurations, like a Discord activity feed and a Twitter sales feed.
Originally developed for @dutchtide's 𝕄𝕚𝕕𝕟𝕚𝕘𝕙𝕥 夏季 𝔹𝕣𝕖𝕖𝕫𝕖 collection.
An OpenSea API key is needed - create one in your account.
To run multiple instances of this bot at once check out bot-runner. Also check out discord-nft-embed-bot.
Please define the env variables outlined in this section for the repository to work as intended.
Valid event types
Valid string values for event types to react on are:
listing
offer
sale
transfer
CHAIN
ethereum
.TOKEN_ADDRESS
OPENSEA_API_TOKEN
DISCORD_EVENTS
662377002338091020=order,sale
662377002338091020=order&924064011820077076=sale,transfer
DISCORD_TOKEN
DISCORD_TOKEN
, create a Discord app. Create a bot with the permissions: Send Messages
and Embed Links
. Then add your bot to your server.DISCORD_TOKEN
looks like this: OTE5MzY5ODIyNzEyNzc5NzUz.YBuz2g.x1rGh4zx_XlSNj43oreukvlwsfw
If your discord bot is not able to post messages ensure it is added to the channels you've specified and it has the permissions to Send Messages
and Embed Links
.
TWITTER_EVENTS
sale,transfer
Create an application in the Twitter Developer Platform and provide:
TWITTER_CONSUMER_KEY
TWITTER_CONSUMER_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_TOKEN_SECRET
Ensure your key is created with "write" permissions, the default key may be "read" only. If that happens you will get an error when trying to tweet; you can regenerate and provide the updated key.
OPENSEA_BOT_INTERVAL
QUERY_LIMIT
MIN_OFFER_ETH
TWITTER_PREPEND_TWEET
TWITTER_APPEND_TWEET
yarn start
I recommend to use DigitalOcean over Heroku for improved stability. Heroku servers can restart (cycle) which can lead to duplicate posts since the ephemeral disk is lost.
My preferred setup is a $5/month Basic Droplet with Ubuntu. Install Node v16 and yarn, clone this repo, cd into it, run yarn
, install pm2 with yarn global add pm2
, set env vars, run pm2 start yarn -- start
. Monitor with pm2 list
and pm2 logs
. Add log rotation module to keep default max 10mb of logs with pm2 install pm2-logrotate
. To respawn after reboot, set your env vars in /etc/profile
, then run pm2 startup
and pm2 save
.
Support this project by using the referral badge below: