A Discord bot that tells jokes, provides Apex Legends
player stats, tells random Today In History
facts and that sends you a joke through PM whenever mentioned.
Chatterton
is named after the poet Thomas Chatterton whose appearace has been gracefully disguised with ThugLife
glasses above.
!stats
: Provides Apex Legends player stats.- Usage:
!stats PLATFORM NICKNAME
. PLATFORM needs to be replaced by the platform. This can be eitherorigin
,PSN
orXBOX
. NICKNAME is the name of the of player.
- Usage:
!tih
: Short forToday In History
. Gives you a historical fact for current date randomly selected from here.!joke
: Tells you a joke! This was implemented by consuming the JokeAPI.!commands
: Does what I just did: tells you what are the available commands.
Chatterton
uses the dotenv
gem in order to access Environment Variables for the required API key and Discord Token.
Follow the next steps to configure all that's needed:
- Download/clone this repo to your local machine
- Execute
touch .env
from the projects root directory - Go to Discord's Developer Portal to create a new App and click on the
New Application
purple button - Give it a name once created click on
Bot
on the left column - Now click on the Copy button
- On your
.env
file add your token like this- DISCORD_TOKEN=PLACE_TOKEN_HERE
- To get the Apex Legends Tracker API go here:
- Apex Tracker API. You need to create an account and get an API Key.
- Put that key on your
.env
file as follows:- APEX_API=PLACE_API_KEY_HERE
- Run
bundle install
from the project's root directory to install dependencies. - Run `bundle exec bin/chatterton.rb'
Before actually using the bot on your server you need to invite it. The best step by step tutorial to do so can be found here.
Once you have invited the bot to your server you can start to use its commands.
Keep in mind that free API's often have a limit and the Apex Tracker is not the exception. Do not spam the !stats
command since the API will stop responding.
In order to deploy the bot to Heroku you need a free Heroku account and follow the next steps:
-
Go to your Heroku Dashboard and click on the
New
button located on the top-right corner. -
Click on
Create new app
and then give it a name. -
Select a Deployment Method. GitHub is the easiest one since you only need to provide your credentials. To deploy from GitHub you need to have a copy of the source code hosted there, so do that before selecting GitHub as deployment method.
Remember NOT to commit API credentials to public places. The .gitignore
file should handle that already but make sure you're not doing it.
- Set your API Credentials in Heroku as Environment Variables by clicking on the
Settings
tab and then adding them to theConfig Vars
section. - Go to the
Resources
tab on Heroku and click on the pencil icon to edit the Heroku Dyno. - Turn it on and click on Confirm. Once you do that everything should be ready.
Josias Alvarado
- GitHub: @pointerish
- Twitter: @pointerish
- LinkedIn: Josias Alvarado
Contributions and issues are welcome!
Give a ⭐️ if you like this project!
This project is MIT licensed.
- Microverse
- The Apex Legends Tracker
- The Muffin Labs
- Ruby Community