Skip to content

Discord Bot that provides information on the current Apex Legends Map Rotation

License

Notifications You must be signed in to change notification settings

philliplam8/apexbot-redo-nodejs

Repository files navigation

Apex Legends Map Rotation Bot

This is a Discord Bot that provides information on the current Apex Legends Map Rotation updates and will send wholesome Gibby TTS messages when you are sad in the chat.

Usage

  • Use slash command /map or type !map into any channel in the server.

    This will return the current public and arenas map, their remaining minutes, and their next map.

  • Type any text message with the key phrase "sad" (case not sensitive)

    This will trigger a randomized wholesome TTS (text to speech) quote by Makoa Gibraltar.

Screenshot

Slash command /map
demo screenshot desktop view

DemoGibbyTTS.mp4

Getting Started

Pre-requisites

  • Discord Account

Installation

This project will use the following APIs and free services to run and host the applicationgit

1. Clone and install dependencies

  1. Clone this project
    git clone https://github.com/philliplam8/apexbot-redo-nodejs.git
  2. Use the package manager npm to install the following dependencies
    npm install 

2. Environment Variables File

IMPORTANT: Ensure the .env file is not made available to the public i.e. not uploaded to a public repository (to workaround this, use a .gitignore file). Your tokens and secrets should be kept hidden and treated like a password as they can be misused. If they are compromised, re-issue a new token/secret from the application accordingly.

  1. Create an environments variable file called .env in the root directory of the project
  2. Copy and paste the following into the .env file
    # DISCORD -----------------------------------------------------------------------
    
    ## Discord Bot Tokens
    DISCORD_TOKEN = ''
    
    ## Discord Bot Client Ids
    CLIENT_ID = ''
    
    ## Disord Server Guild Ids
    GUILD_ID = ''
    
    # APEX API ----------------------------------------------------------------------
    APEX_LEGENDS_API_TOKEN = ''
  3. In the following next steps, we will be adding several environment variables into this file

3. APEX API

  1. Visit third party Apex Legends API
  2. Follow the instructions on the site and generate an API key
  3. Copy the API key generated
  4. Paste the API key into the .env file APEX_LEGENDS_API_TOKEN variable

4. Create and Add Discord Bot to Server

  1. Visit Discord Developer Portal
  2. Sign into Discord
  3. Click New Application
  4. Create a name and click Create
  5. Click on the OAuth2 > General settings tab
  6. In the Client ID section, click Copy
  7. Paste the value into the .env file CLIENT_ID variable
  8. Click on the Bot settings tab
  9. In the Token_ section, click Generate
  10. Paste the value into the .env file DISCORD_TOKEN variable
  11. Click on the OAuth2 > URL Generator settings tab
  12. In the Scopes section, check bot and application.commands
  13. In the Generated URL section, click Copy
  14. Paste the URL into your browser
  15. Add the Discord bot to your desired server
  16. Enable developer mode on Discord (see instructions)
  17. Right click on your desired server and click Copy ID
  18. Paste the value into the .env file GUILD_ID variable

5. Create a new Heroku app and deploy app

Heroku is used here, but feel free to use any hosting method (local, AWS, etc.)

  1. Visit Heroku and create a new account (or sign in with an existing account)
  2. Click New > Create new app
  3. Following the instructions to Deploy using Heroku Git
  4. Visit the Settings Tab
  5. Click on Reveal Config Vars
  6. Copy and paste all key/values from the .env file into the Heroku Config Vars section
  7. Click on More > View Logs and ensure the app has been deployed successfully

6. Setup FreshPing to periodically ping Heroku app

  1. Visit Freshping and create a new account (or sign in with an existing account)
  2. Click + Add Check
  3. Enter the Heroku app URL into the Check URL field
  4. Set Check interval = 5 min
  5. Click Save

License

ApexBot is licensed under the MIT license

About

Discord Bot that provides information on the current Apex Legends Map Rotation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published