Deldbot is a Discord Bot written in Node.js, utilizing Discord.js and several other open source libraries
- Node.js
- npm
- Jest
- discord.js
- d20
- finnhub
- howlongtobeat
- itad-api-client-ts
- openai
- plex-api
- pm2
- popyt
- Plex API
- OMDb API
- Imgur API
- IsThereAnyDeal API
- Youtube Data API
- Finnhub API
- CoinMarketCap API
- ChatGPT API
These steps provide a good walkthrough of creating and running a Discord bot: https://www.digitaltrends.com/gaming/how-to-make-a-discord-bot/
- Go to discordapp.com/developers/applications
- Click on New Application and supply a name
- Click on your new application
- Copy the Client ID and Client Secret
- Click on Bot under Settings on the left hand side
- Enter a username and copy the Token
- Check what permissions will be needed, all of the text permissions should be sufficient (522304)
- Open up the following URL, replacing the CLIENT_ID and permissions with your own values: https://discordapp.com/oauth2/authorize?&client_id=CLIENT_ID&scope=bot&permissions=0
- On this GitHub page click on Code -> Download ZIP
- Unzip the repository code somewhere on your machine
- Open up the Windows CMD prompt and run as administrator or open up a Linux terminal
- Change directory to where the downloaded code resides
- Run the following: npm install
- Optional: if you run into cache issues use the following: npm cache clean --force
- Copy ./config.json into ./.env/config.json
- Go through the following and generate API keys and tokens for the functionality you want
- Obtain the Plex token of your server by referencing the following link: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
- Obtain an OMDb API key from https://www.omdbapi.com/apikey.aspx
- Obtain an ITAD API key by setting up an account and creating a new application at https://isthereanydeal.com/dev/app
- Obtain a Youtube API key by setting up an account and creating a new application at https://console.developers.google.com/apis/credentials and enable the YouTube Data API v3 at https://console.developers.google.com/apis/api/youtube.googleapis.com/overview
- Obtain a Finnhub API key from https://finnhub.io/docs/api
- Register an application and obtain an Imgur client id and secret from https://api.imgur.com/oauth2/addclient
- Obtain a CoinMarketCap API key from https://coinmarketcap.com/api
- Obtain a ChatGPT API key from https://platform.openai.com/account/api-keys
- Update ./.env/config.json with your Discord bot's client id, client secret, token, Plex id, Plex token, Plex username, Plex password, Plex token, Plex server hostname, Plex server port, OMDB API key, ITAD API key, Finnhub API key, Youtube API key, Imgur client ID, Imgur client secret, Imgur album ID, CoinMarketCap API key, ChatGPT API key, and ChatGPT organization you wish to use. Many of these are optional depending on what functionality you would like to use.
- In Discord, go to User Settings > Appearance, enable Developer Mode, right-click your username, Copy ID, paste that number into the owner.id key in ./.env/config.json
- Run the following: npm run start or node bot.js
- If you wish to use pm2 to run the bot to ensure it restarts automatically from crashes, run the following: pm2 start bot.js
- You may need to install pm2 with: sudo npm install pm2 -g
- Voila, you can now start to issue commands in your Discord server and test out if the bot is working right
- cd to the root of the deldbot folder
- docker build -t deldbot-image:latest -f docker/Dockerfile .
- docker run -it deldbot-image:latest sh
- docker ps -a
- docker rm
$(docker stop $ (docker ps -aq --filter ancestor=deldbot-image --format="{{.ID}}")) - Alternate tear down commands:
- docker ps -aq | xargs -n 1 docker stop
- docker ps -aq | xargs -n 1 docker rm
- docker system prune -a
- docker images -a
npm run test
- Discord Webhooks: https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks
- Plex Webhooks: https://tautulli.com/ and https://github.com/Tautulli/Tautulli-Wiki/wiki/Notification-Agents-Guide#discord
- GitHub Webhooks: https://gist.github.com/jagrosh/5b1761213e33fc5b54ec7f6379034a22
- Gitlab Webhooks: https://docs.gitlab.com/ee/user/project/integrations/webhooks.html
- Integromat: https://www.integromat.com/
See: src/commands
for a list of available commands or run !help for more information
- https://discordjs.guide/
- https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID
- https://cog-creators.github.io/discord-embed-sandbox/
- https://www.themoviedb.org/documentation/api?language=en-US
- https://rapidapi.com/imdb/api/movie-database-imdb-alternative
- https://izy521.gitbooks.io/discord-io/content/Methods/Handling_audio.html
- https://gifrun.com