Developer & API

API Setup

This guide is a work-in-progress and is currently designed for power users. If you need help with the API, please don't hesitate to join our Discord server.

First-time API setup

Set an API key

Choose an API key (essentially the password to your API). We recommend using a password generator, as this value being guessed could lead to a malicious user gaining full access to your bot account.

Once you have chosen the API key, run this command, replacing [value] with the key:

echo "API_KEY=[value]" >> .env

Enable the API in your config

If you just logged in to your VPS, run cd qbot to enter Qbot's directory. Then, you can run nano src/config.ts to open the configuration in a text editor. Read this for a refresher on how to use this editor.

Use Ctrl+W to search for the first usage of api, and set the value to the right of it to true.

Save your changes

Press Ctrl+X, then y, then enter to save your changes in nano. To restart Qbot, run this command:

pm2 restart 0

You're [technically] all set!

Qbot will now be listening to port 3001 for requests. However, it is important to note that with most hosting providers, the API will not be accessible at Your-Ip:3001 just yet.

You will more than likely need to setup a reverse proxy and domain, or change the firewall somehow to accept external requests there. This varies by hosting provider, so look into how to make a web server accessible with yours.

Previous
Customizing bot appearance