Giter VIP home page Giter VIP logo

nft-discord-bot's Introduction

NFT Discord Bot

This is a discord bot for ERC721 NFT collections, all the token metadata is being retrieved from opensea at the moment, instead of directly from the tokenURI in the smart contract.

Supported functions

The following functions are currently supported:

User Commands

!TOKEN_COMMAND [tokenId]

Retrieves the NFT based on the supplied tokenId, returns an embed message as follows. The actual TOKEN_COMMAND can be any keyword you like and is configurable via environment variables as described below.

token command example screenshot

!floor

Retrieves the current price floor that's listed for sale on OpenSea. Results are cached and will not update more than once every 60 seconds.

The bot's post will contain the current price with a link to the item for sale on OpenSea.

floor command example

Automatic Posts

Sales

The bot will look up sales events on OpenSea every 30 seconds, and all newly closed sales will be posted to the configured Discord channel.

Sales bot example

Listings

The bot will look up sales events on OpenSea every 30 seconds, and all newly created sales listing will be posted to the configured Discord channel.

Configuration

Discord Application

You'll need to create a Discord Application first, see https://discord.com/developers/applications

Bot Configuration

All configuration is done via environment variables, which are as follows:

Env Var Description
CONTRACT_ADDRESS Ethereum address for the NFT Smart Contract
DISCORD_BOT_TOKEN Pretty self explanatory
DISCORD_SALES_CHANNEL_ID The discord channel id where sales events should be posted to, should look like a long number.
DISCORD_LISTING_CHANNEL_ID The discord channel id where listing events should be posted to, should look like a long number.
DISCORD_TOKEN_COMMAND The command word you'd like the bot to respond to for posting token information, pick a simple word that represents the collection, see example above
OPEN_SEA_API_KEY Contact OpenSea to request an API key at https://docs.opensea.io/reference#request-an-api-key. OpenSea's Events API now requires the API key and won't work without one.
OPEN_SEA_COLLECTION_NAME The collection slug name on OpenSea, get this from the browser when you are viewing a collection, e.g. the collection name for https://opensea.io/collection/boredapeyachtclub is "boredapeyachtclub"

Deployment

If running locally, just checkout the repository and run

npm install

followed by

npm start

You can also deploy directly to Heroku in just a few minutes.

Deploy

If you use the free dynos in Heroku, they go to sleep every 30 minutes unless there's a request on the endpoint, you can set up a free cron job online to poll your app every 20 minutes or so to keep it alive. https://cron-job.org/

nft-discord-bot's People

Contributors

lucid-eleven 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nft-discord-bot's Issues

Anybody else encountering OpenSea API issues after the a6f25904d0dd9e551e94fd24d4bf3ac6bfad50f1 commit changes?

I'm encountering issues when I access the OpenSea API via a Heroku worker - I'm able to run the https://github.com/lucid-eleven/nft-discord-bot/blob/main/cronjobs/listing.js code successfully when I execute the code (slightly modified) from terminal.

Might not be related, I'm encountering the following when I execute the same request via Postman (again I'm able to successfully execute the code via terminal)

"

<title>400 Bad Request</title>

400 Bad Request


cloudflare "

I'm wondering if there is an IP block situation happening...that is somehow tied to the Heroku server? Because my local IP is not blocked, as evidenced by the fact that I am able to successfully execute the code via terminal...

Too Many Requests

Hello,

I already have an API and everything works but I'm constantly getting this messages:

Error: Couldn't retrieve events: Too Many Requests
at Object.execute (/root/suk/tcbc/cronjobs/listing.js:37:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Couldn't retrieve events: Too Many Requests
at Object.execute (/root/suk/tcbc/cronjobs/sales.js:37:17)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Anything I can do to fix this?
I also noticed the notifications are very delayed compared to bots running on other Discord Servers.

Thank you!

Sales & Listings not indicated

Hello!

First off thank you for creating this repository. It's a great starting point!

My question: is it possible that OS NFT sales and listings are lagging behind - a lot?

For me at the moment the bot is running nicely: !floor and !show are working like a charm, but sales and listings don't appear at my designated discord channel. I logged the OS query outputs and Date comparisons - it seems like the code never goes past the "created_date < lastTimestamp" function. I haven't yet identified if the "lastTimestamp" is wrongly set. Have been keeping the bot running for several hours now listing my own NFTs for sale or doing tests private sales between my accounts.

Looking forward to your reply,
VI

salesforce use policy violation?

Getting this when trying Heroku deployment. I've forked from you, have it running... not sure what's going on. Have to admit I'm very much a code noob so hope this is just something stupid and minor that I'm doing.
146274858-ebf0bfc1-ed95-41f9-9e44-f37013123b8e

INSTALL

I wish you would make a video for installation

[Symbol(code)]: 'TOKEN_INVALID'

everytime i try to run it, says [Symbol(code)]: 'TOKEN_INVALID', even though i am sure and have tested different working bot tokens :(

ReferenceError: data is not defined

Hi! I'm trying to add this bot to my Discord but the Heroku logs shows this error. Any clue how to fix this?


2021-09-30T22:39:38.019199+00:00 app[web.1]: (node:22) UnhandledPromiseRejectionWarning: ReferenceError: data is not defined
2021-09-30T22:39:38.019206+00:00 app[web.1]:     at Object.execute (/app/cronjobs/sales.js:75:17)
2021-09-30T22:39:38.019207+00:00 app[web.1]:     at runMicrotasks (<anonymous>)
2021-09-30T22:39:38.019207+00:00 app[web.1]:     at processTicksAndRejections (internal/process/task_queues.js:95:5)
2021-09-30T22:39:38.019241+00:00 app[web.1]: (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)

Matic Assets

I'm trying to use this bot for a collection of polygon assets, I'm wondering if this change in the asset type is the reason this bot isn't working for me?

I can list the floor price but searching for a token ID gets me the "doesn't exist" error.

Additionally the sales cronjob fails due to a bad request. (sales.js:37:17)

Workarounds for not having OS Api?

So as it's kinda hard lately to get an OS api key. Is !floor command works but getting metadata wont. Any idea how to workaround this or get metadata from other nft sites?

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.