Loquitor on Heroku
Running Loquitor on Heroku isn’t really hard. I created a Github repository that makes it relatively easy (forked from xrisks’s repository). That repository includes
runner.py, which is the file that sets all the Loquitor instances in motion.
To interact with Heroku from your computer, you will need to install the Heroku CLI. The official instructions are here. Once that is installed, give it your credentials with
The first thing to be done is to create a Heroku application (You must be logged in.) Next, set the environment variables. To do that, head over to the settings for your application and click “Reveal Config Vars”. You can then add the variables from there. To get Loquitor running,
LOQ_PASSWORD are required. Make sure that the account you use has >20 reputation. If you have Bing translation credentials, they can be supplied with the
Once the environment variables are set, you can add the code. This can be done either through Github or through your computer. Through Github, you need to connect the application to a repository. That repository would be a fork of mine. To do that, fork mine and edit the Procfile to give the IDs of the rooms you want your bot to enter. Once it’s forked, you can connect it to your application. That is done in the “Deploy” tab of your application. In that tab, it’s pretty intuitive if I remember correctly. You’ll need to give permission to Heroku to access your Github account.
To go through your computer, you first need to clone my repository. That’s done with
git clone https://github.com/ralphembree/Loquitor-Heroku.git. Now go into that folder in your terminal. That will probably be something like
cd Loquitor-Heroku. Once you have the code, you can edit the Procfile to use the IDs of the rooms you want to enter. Right now, that’s only on Stack Overflow, but you can edit the runner.py to get it to run on Stack Exchange or Meta Stack Exchange. Once the code is how you want it, add the Heroku repository as a remote. That is simply
heroku git:remote -a your-app-name. Now run
git add . and
git commit -a. Give it a commit message, and run
git push heroku master. That will upload your code to Heroku.
Once the code is uploaded, you need to tell Heroku that you’re using just a worker script, and no web script. That is done with
heroku scale worker=1. If you aren’t in your application’s folder (or if you’re connecting through Github and don’t have a folder), you will need to specify which application to run it on with
-a your-app-name. That’s all! Loquitor can now run under your account in whatever rooms you want.