GithubHelp home page GithubHelp logo

v1ra1 / coinmarketcapbot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 148 KB

Discord bot that uses CoinMarketCap api to stream a coins price to a discord accounts nickname and price change to the activity.

Java 100.00%

coinmarketcapbot's Introduction

CoinMarketCap Discord Bot

This is a discord bot that uses coinmarketcaps api to get the quoted price converted to usd for a coin.

Setup

Go to the root of the project and type:

./gradlew.bat build

If on windows dont use ./

Once it is built you can navigate to build/libs, and you will see CoinMarketCapBot-1.2.jar

Config

When you first run the bot it will create a app.config file. If you want to skip it automatically creating it place a file where the jar file is called app.config with the following:

#This is the coinmarketcap api key that you get from here https://coinmarketcap.com/api/
COINMARKETCAP_API_KEY=
#This is the discord guild id. You can get it by turning on developer mode by going to settings in discord -> Advanced -> Developer Mode
GUILD_ID=
#This is the symbol that is uses. Example HEX
COIN_TOKEN=
#This is the discord token you generate from the discord bot after creating a application in https://discord.com/developers/
DISCORD_TOKEN=
#The amount of time it takes before doing an update of the bots nickname and activity
INTERVAL_MINUTES=15
#The presence message type is price percentage changed in 24 hours. Change it to any of the following below
PRESENCE_MESSAGE_TYPE=percent_change_24h
#This will determine the decimal placement on the price
PRICE_FORMAT=0.00

PRESENCE_MESSAGE_TYPES

  • price - Price of the coin
  • volume_24h - Volume of trades in the last 24 hours
  • volume_change_24h - Volume percentage changed in the last 24 hours
  • percent_change_1h - Price percentage changed in the last hour
  • percent_change_24h - Price percentage changed in the last 24 hours
  • percent_change_7d - Price percentage changed in the last 7 days
  • percent_change_30d - Price percentage changed in the last 30 days
  • percent_change_60d - Price percentage changed in the last 60 days
  • percent_change_90d - Price percentage changed in the last 90 days
  • market_cap
  • market_cap_dominance
  • fully_diluted_market_cap

Installing JDK 8

Centos

yum -y update
yum install java-1.8.0-openjdk

Ubuntu

sudo apt-get update
sudo apt-get install openjdk-8-jdk

Mac

brew install --cask java8

Windows

https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

Running

java -jar CoinMarketCapBot-1.1.jar

CoinMarketCap Api Setup

Go to https://coinmarketcap.com/api/ and click the button "GET YOUR API KEY NOW". It takes less than 5 min to setup.

It is also FREE.

CoinMarketCap offers 10,000 requests a month with 333 request per day.

So you can set the INTERVAL_MINUTES to 5 mintues and you will have enough free requests for a whole month.

Discord Application Setup

Go to https://discord.com/developers/applications and click New Application. Once you have created a new application click into it if it does not navigate you to it. Then set the APP ICON. Next navigate to Bot and create a bot. Click the token reveal and copy it. You will be using this in the app.config.

Next navigate to the OAuth2

img.png

Copy the link and navigate to it. It will ask you to authorize the bot into the server.

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.