/statsbot

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

Primary LanguageJavaScriptMIT LicenseMIT

StatsBot - A Discord Bot to gather data from public APIs

CodeQL

Note
This project does participate in the Hacktoberfest 2022 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.

✨ How to contribute

Warning
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
/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
/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

🔧 Installation

Prerequisites

  • Node.js (v16.6.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.