NFT Discord Bot

📘

Want to go straight to the code?

Check out the github

Reservoir Discord Bot provides communities easy to use commands and alerts for their
Discord server, which can be expanded and customized to their liking. Come test the bot out now in the Reservoir discord server!

The Discord bot ships with the following functionality:

  • Automated alerts for new listings, sales, floor listings, and top collection bids

  • Collection search to view stats, current top bid, and current floor price
/collection [name: collection name to search for (ex. forgotten runes)] [limit: number of collections to return]

Getting Started

Prerequisites

  1. Install Node.js and NPM
  2. Request a free Reservoir API Key
  3. Setup a Discord application and bot

Built With

Installation

Method 1: Docker Setup (Recommended)

  1. Install Docker
  2. Fork this repository, and follow these instructions to get your Discord bot running
# Copy env vars sample file
cp .env.sample .env

# Set env vars in editor of your choice
vim .env

# Set constants in editor of your choice
vim src/utils/constants.ts

# Create and start the docker container
docker compose up -d

Method 2: Manual Setup

  1. Install Redis and start the server on the default port (6379)
  2. Fork this repository, and follow these instructions to get your Discord bot running
# Copy env vars sample file
cp .env.sample .env

# Set env vars in editor of your choice
vim .env

# Set constants in editor of your choice
vim src/utils/constants.ts

# Download dependencies
npm install

# Start the Discord bot
npm run start

Configuration

Environment Variables

Environment VariableDescriptionExample
TOKENYour Discord bot's tokenNzkyNzE1NDU0MTk2MDg4ODQy.X-hvzA.Ovy4MCQywSkoMRRclStW4xAYK7I
RESERVOIR_API_KEYReservoir API key provided by the Reservoir Protocol. Get your own API key.123e4567-e89b-12d3-a456-426614174000

Constants

ConstantDescriptionDefault
ALERT_COOLDOWNNumber of seconds to wait before sending a new floor price or top bid alert60 * 30 (30 minutes)
PRICE_CHANGE_OVERRIDEPercentage change in floor price to override alert cooldown0.1 (10%)
ALERT_ENABLEDEnable/disable new listings, sales, floor price, and top bid alertslistings: false, sales: false, floor: true, bid: true
APPLICATION_IDYour Discord application id5736050287834562
CHANNEL_IDSThe Discord channels you want the bot active in123456789098765432
ALERT_CONTRACTThe contract address of the collection you want to be alerted of floor price and top bid changes0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb
TRACKED_CONTRACTSThe contract address(es) of the collection(s) you want to be alerted of new listings and sales[0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb]
REDIS_HOSTRedis host to connect to (For Docker set to "redis")127.0.0.1
REDIS_PORTRedis port to connect to (For Docker set to "6379")6379