This guide is written for Linux systems.
The process is similar on Windows, but the commands may differ.
Alternatively, you can install the bot on Windows with Docker.
Before you start, you need to make sure your system meets the requirements.
If you don't have a suitable version of Node.js (you can check with node-v) and a database installed,
these community guides may help.
Node.js installation
How to install Node.js on various operating systems and distributions.
Start by cloning the most recent release from GitHub with the following command,
where <tag> is the name of the latest release tag,
which you can find at the top right corner of this page,
or on the releases page.
By default, this will clone the repository into a folder called bot,
but you can change this by adding a folder name after the URL.
Don't skip this section if you already know how to create a Discord application;
Discord Tickets requires additional configuration.
Using an existing application is not recommended.
Give your application a name, accept the terms of service and click Create
3. In the page that appears you can add a logo, description, or links to your terms of service and privacy policy if you wish to, and then click Save Changes.
Go to the OAuth2 page and click Reset Secret, then Yes, do it!.
Copy the new secret and set it as your DISCORD_SECRET environment variable.
5. Click Add Redirect and enter the value of your HTTP_EXTERNAL environment variable, followed by /auth/callback.
Then click Save Changes.
Examples
http://12.345.67.89:8080/auth/callback
https://tickets.example.com/auth/callback
If you set this to https://tickets.example.com/auth/callback,
your HTTP_EXTERNAL environment variable must be set to https://tickets.example.com(without a trailing /).
6. Navigate to the Bot page
Click View Token, then copy the token and set it as your DISCORD_TOKEN environment variable.
We highly recommend disabling the "Public Bot" option to prevent other people from adding your bot to their servers. Before you can do so, you will need to go to to the Installation page and set Install Link to None. After saving changes, return to the Bot page and disable the "Public Bot" option.
Enable the presence, server members and message content intents.
Don't add the bot to your Discord server yet; you'll do that later.
The only other required non-default environment variables are DB_PROVIDER,
and DB_CONNECTION_URL if you are not using SQLite as your database.
Tip
You can middle-click on links to open them in a new tab
so you can easily come back to the documentation!
Refer to the configuration documentation for more information about the available environment variables,
and return to this page when you have finished.
After setting the required environment variables, run the post-install script again:
npmrunpostinstall
pnpmrunpostinstall
This will connect to the database (or create it if using SQLite) and apply migrations to create the tables according to the schema.
It will also generate the Prisma ORM client.
The first time you start the bot, it will copy the default configuration into user/config.yml.
If you want to customise your bot's status/activities, refer to the configuration guide.
You will need to restart the bot for the changes to take effect.
Currently, the process will end when you close the terminal (or disconnect your SSH session).
To run the bot in the background, you can turn it into a service with systemd, screen, pm2 etc.