Git Product home page Git Product logo

opensea-activity-bot's Introduction

opensea-activity-bot

Example Discord messages

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.

Setup

Env

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

Project-specific

APIs

  • OPENSEA_API_TOKEN

To share on Discord

  • DISCORD_EVENTS
    • The Discord channel ID with a comma separated list of event types for the bot to send through discord
      • e.g. 662377002338091020=order,sale
    • For multiple channels separate with an ampersand (&)
      • e.g. 662377002338091020=order&924064011820077076=sale,transfer
  • DISCORD_TOKEN
    • To get your DISCORD_TOKEN, create a Discord app. Create a bot with the permissions: Send Messages and Embed Links. Then add your bot to your server.
    • The 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.

To tweet

  • TWITTER_EVENTS
    • Comma separated list of event types for the bot to tweet
    • e.g. 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.

Optional

  • OPENSEA_BOT_INTERVAL
    • Number of seconds interval for the bot to run (default: 60)
  • QUERY_LIMIT
    • Limit for the OpenSea Events query (default: 50)
  • MIN_OFFER_ETH
    • Offers or bids less than this amount will be ignored (default: 0)
  • TWITTER_PREPEND_TWEET
    • Message to add to start of tweet, such as a hashtag
  • TWITTER_APPEND_TWEET
    • Message to add to end of tweet, such as a hashtag

Run

yarn start

Running on a server

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:

DigitalOcean Referral Badge

opensea-activity-bot's People

Contributors

ryanio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

opensea-activity-bot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.