This is a template for creating your own scheduled Fortnite Item Shop and BR News twitter bot using python and heroku.
- heroku
- account and Heroku CLI: for hosting python app and keeping it running
-
Click the "Use this template" button and create your own repo
-
Create a new heroku app on the Heroku Dashboard by clicking on
New
and selectingNew App
.- Select your server and confirm its creation.
- Make sure your Heroku account is connected to your github account via the
Deploy
tab. - Enable automatic deploys and select your repository.
- Click on
Deploy Branch
to ensure a copy of the repo is initialized and ready on heroku. - Go to the
Resources
tab and make sure that the dyno worker is switched off! This is a very important step on creating this bot, so keep that in mind.
-
Verify your Heroku account
- This is needed because of Heroku's requirements, and you need to verify your acccount if you want to use add-ons, which is required for this program.
- Go to this page and enter your credit card details
- Don't worry! Your card will never be charged for this program and will only serve as Verification of your Heroku account.
- You do not need a paid plan for this. I use the free version of Heroku since we'll only use this once or twice a day.
-
Create a new twitter account. (If you already have one, please use your twitter account instead and skip straight to step 3.)
- Use your current email to create the account by adding a tag.
- Confirm the email address associated with this new twitter account.
-
From your main twitter account (not the one you just created, unless this is your first twitter account!) create a new twitter app.
- Apply for a Twitter developer account, and select
Making a bot
. Enter the necessary details and submit your application. - This process may take a while, and it may not be instant.
- After your application, create a bot by clicking on the
Create an App
button. - Enter the necessary details.
- Under Settings / Application Type:
- Enable "Read and Write"
- Under Details:
- Click "Create My Access Token"
- Apply for a Twitter developer account, and select
-
Create an
.env
file containing your twitter keys.- In your local repo, create a file called
.env
, and then copy everything from this paste - Replace the placeholders with your credentials. You can only view it once on the twitter page until you close it, so copy everything to the
.env
file. - For heroku, use
heroku-config
to copy contents of.env
to your heroku app.- Configure your heroku app by launching
heroku git:remote -a [insert your heroku app name here]
on the folder of your cloned Github repo. - Install heroku-config:
heroku plugins:install heroku-config
. - Now run
heroku config:push
.- NOTE: To update heroku environment variables later, run
heroku config:push --overwrite
- NOTE: To update heroku environment variables later, run
- Configure your heroku app by launching
- In your local repo, create a file called
Okay, now here's the fun part:
-
Personalize your message and background!
- Change the
twitterbot.sh
URLs. The default settings have my branding on it, so you may need to replace thebackground
URL to something different, or remove it entirely.- If you want to create your own backgrounds, please refer to the
media
folder for the image size and positioning. - The images I use are
news.jpg
andnitestats.jpg
. Change them to anything you like.- If you want to have weekly SAC reminders, the image I use is
SAC_Reminder.png
on theoutput
folder.
- If you want to have weekly SAC reminders, the image I use is
- To get the Image URL, go to the image you uploaded on your github repo and open it on a new tab.
- If you want to create your own backgrounds, please refer to the
- Change the message and timezone on
app.py
andnews.py
.- OPTIONAL: If you want weekly SAC reminders, change
sac.py
as well. - You can also remove the Timezones and its references if you don't want the time on your tweets.
- OPTIONAL: If you want weekly SAC reminders, change
- Change the
-
Commit and push local changes to Github. Heroku will automatically update the remote files since you have Heroku connected.
-
On your Heroku app dashboard, go to the
Resources
tab and add theAdvanced Scheduler
add-on.- Make sure your Heroku account is verified for this!
- Click on it, and create a new trigger.
- Add a name, and make sure the command is
bash twitterbot.sh
, and the timezone is UTC. - Make it a recurring trigger and select the
Schedule Helper
option. - Item shop resets every day at 12:00AM UTC. Save the trigger.
- If you use
sac.py
, do the same steps. Except this time, you must change the interval to weekly and the time to be Tuesdays at 8:00AM UTC.
- If you use
Please check out the Nitestats Discord for updates on the API. Please redirect all questions and bug reports about the API to this discord. Thank you!