StockBot is a Discord bot designed to fetch various stock data based on user input commands. It uses Discord.js for development and Polygon.io to fetch the stock info.
To add StockBot to your Discord server go to this link (if the commands don't work when you add it that means I'm not paying for a server to host the bot at the moment):
- Go to this link: https://discord.com/oauth2/authorize?client_id=1241418921014464512
To run the bot locally on your machine and make custom changes follow these steps:
- Go to the Discord Developer Portal and create a new bot with a name of your choice.
- Navigate to the Bot tab and enable all three Privileged Gateway Intents.
- Go to the OAuth2 section and, under the OAuth2 URL Generator, check
application.commands
andbot
. Under BOT PERMISSIONS, grant Administrator privileges. - Return to the Bot tab, click on Token, and then click Reset Token. Save the generated token. Remember to reset the token each time the code is compromised or lost.
- Invite the bot to your server using the OAuth2 URL generated.
- Go to Polygon and create a free account
- Create a folder on your computer.
- Clone this repository into the folder.
- Open a terminal inside the folder and execute the following commands:
npm init -y
(sets up project info) (in the package.json under main change it to src/index.js instead of index.js)npm install discord.js
(installs the package required to interact with Discord)npm install -g nodemon
(installs nodemon, a utility that monitors for changes and automatically restarts the server)npm install dotenv
(allows you to store your API keys in an environment var)
- Create a .env file at the same directory level as your package.json and inside add two things
- DISCORD_BOT_TOKEN=Your Discord Token I said to copy earlier
- POLY_API_KEY=Your Polygon Api key from your Polygon Dashboard
- After everything above is complete, you can start the bot by running
nodemon
in the terminal.
StockBot was created by Soor Hansalia.