Skip to content

Discord Bot to gather data from public APIs using node.js and discord.js! Hacktoberfest Event Project

License

Notifications You must be signed in to change notification settings

thieleju/statsbot

Repository files navigation

StatsBot - A Discord Bot to gather data from public APIs

CodeQL

Note

This project does participate in the Hacktoberfest event!

A Discord bot which provides various commands to get data from public APIs. This project is using the discord.js library and public APIs from this list or other ressources.

✨ How to contribute

Warning

For the duration of Hacktoberfest, only one issue/pull request per person will be accepted. If you want to contribute more, please look for other repositories here and keep contributing ❤️

  • Navigate to an open issue and ask to be assigned to it (or create one yourself)
  • After you are assigned, fork the repository and create a new branch
  • Make your changes on the new branch and commit them
  • Create a pull request and wait for it to be reviewed
  • Thats it!

For more information check out the Contribution Guidelines

✅ Available commands

Command Description API
/invitelink Shows the invite link for the bot
/ping Pong!
/serverinfo Shows information about the server
/userinfo Shows information about the user
/excuse Sends a random excuse Excuser
/show-chess-leaderboard Shows information about the current chess.com leaderboard chess.com
/trivia Shows a random question, react with ✅ or ❌. opentdb.com
/numberfact Shows a random number fact numbersapi.com
/catfact Shows a random fact about cats. meowfacts
/dogfact Shows a random fact about dogs. Dog API
/dictionary Get definitions and synonyms of words. dictionaryapi
/foxpic Shows a random picture of a fox. RandomFox
/mathquestion Sends a random math question. xMath API
/uptime Shows how long Stats-Bot has been up. Countdown NPM Package
/crypto Provide detail about given crypto currency. coinstat
/motivation Shows a random motivation quote. motivation
/breakingbad Shows a random Breaking Bad quote. Breaking Bad Quotes Api
/dogpic Shows a random dog picture. Dog Pic API
/catpic Shows a random cat picture. Cat Pic API
/duckpic Shows a random duck picture. Duck Pic API
/joke Give you a random joke. Joke API
/chuck Shows a random joke about Chuck Norris Chuck Norris API
/animequote Shows a random anime quote. anime-chan
/bored Get something to do if you are bored. Bored API
/kanye Shows a random quote by Kanye West. Kanye Rest API
/websiteicon Shows the favicon of the requested sit. Icon Horse API
/guessage Guess the age of a specific or random name. Agify API, Random Data API
/npm Query the NPM registry for npm package details. NPM Registry
/stockimage Get a random 1920x1080p stock image. Lorem Picsum
/tecchy Shows a random tech-savvy phrase. TechyAPI
/affirmation Shows a random affirmation quote. Affirmation Dev API
/series Get any tv/web series information CatchTheShow
/meme Send Random Memes. Reddit Random Memes Api
/list-data-breaches Lists data breaches using the haveibeenpwned.com API haveibeenpwned.com
/onthisday Shows a random history event happended on this date. ZenQuotes
/fruit Get interesting information about fruit Fruityvice
/serverip Display server IP and location MyIP API
/guessnationality Guess the country of a specific or random name. Nationalize API, Random Data API
/countryinfo Display information about a specific country. REST Countries
/university Get the domain of a university. Hipo
/countryinfo Display information about a specific country. REST Countries
/breakingbaddeath Shows a random death reason of a Breaking Bad character Breaking Bad Death Api
/advice Shows a random advice. Advice Slip API
/shiba Show shiba inu picture. shibe.online
/yesno Get an answer to any question. yesno.wtf
/xkcd Shows a random xkcd comic. xkcd Swagger REST API
/roboavatar Create a Robotor Avatar by entering a string. Robo Avatar API
/inspiration Get Inspiration. goprogram API
/horoscope Get Horscope. Aztro Api
/whatshouldieat Get a random recipe from themealdb. themealdb API
/ayah Get a verse of Quran. AlQuran Cloud
/encryption Encrypt/decrypt a message using a key. Classify API
/earthevent Return a natural event that occurred in the last 30 days. EONET API
/apod Return an astronomy picture of the day. NASA APOD API
/truefact Get a true fact. Random Useless Facts API
/createloripsum Shows random lorem ipsum text. Loripsum
/urban Shows the definition of a term from Urban Dictionary. Urban Dictionary API
/guessgender Get the gender of a name. Genderize
/shortenlink Shorten the URL. GoTiny
/locateiss locate the International Space Station. open-notify
/password-gen Generate a random password. Random Password Generator

🔧 Installation

Prerequisites

  • Node.js (v16.14.0 or higher)
  • Discord Account

Project Setup

  1. Fork or Clone the repository to your local machine
  2. Navigate to the project root directory (location of package.json)
  3. Run the command npm install to install all dependencies
  4. Setting up a discord bot application
    • Follow this guide on how to set up a new discord application and add a bot
    • Save the Bot Token, Client ID and Client Secret to a new file named .env in the project root directory

Example .env file content:

DC_BOT_TOKEN=<your bot token>
DC_BOT_CLIENT_ID=<your application client id>
DC_BOT_CLIENT_SECRET=<your application client secret>
DC_BOT_PERMISSIONS=274878131264

🚀 How to run the bot

npm run dev

This runs the application with nodemon which automatically restarts the application when changes are made.

🔗 How to invite the bot

  • Option 1: Follow this guide on discordjs.guide
  • Option 2: Use the base Url https://discord.com/api/oauth2/authorize and add following url parameters:
    • client_id: Your application client id (DC_BOT_CLIENT_ID)
    • permissions: All permissions the bot should have when invited as a string (274878131264)
    • scope: bot%20applications.commands

❓ What is Hacktoberfest?

A month-long celebration from October 1st - 31st sponsored by Digital Ocean and GitHub to get people involved in Open Source.

Create your very first pull request to any public repository on GitHub and contribute to the open source developer community.

About

Discord Bot to gather data from public APIs using node.js and discord.js! Hacktoberfest Event Project

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks