Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated install instructions #56

Merged
merged 14 commits into from
Mar 18, 2023
51 changes: 38 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<img align="left" src="https://raw.githubusercontent.com/Tech-TTGames/Tickets-Plus/main/branding/rounded.png" height="200" width="200"/>

[![CodeQL](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/codeql.yml) [![Pylint](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/pylint.yml/badge.svg?branch=main)](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/pylint.yml) [![DeepSource](https://deepsource.io/gh/Tech-TTGames/Tickets-Plus.svg/?label=active+issues&show_trend=true&token=ourUeg696DFMDcZDoZi0ZqGn)](https://deepsource.io/gh/Tech-TTGames/Tickets-Plus/?ref=repository-badge)
[![CodeQL](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/codeql.yml) [![Pylint](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/pylint.yml/badge.svg?branch=main)](https://github.com/Tech-TTGames/Tickets-Plus/actions/workflows/pylint.yml)

[![DeepSource](https://deepsource.io/gh/Tech-TTGames/Tickets-Plus.svg/?label=active+issues&show_trend=true&token=ourUeg696DFMDcZDoZi0ZqGn)](https://deepsource.io/gh/Tech-TTGames/Tickets-Plus/?ref=repository-badge)

A Discord bot that adds extensions to the [Tickets](https://github.com/TicketsBot) discord bot.[^1]
Made by the Tickets+ team, a group of volunteers[^0] who want to add features to the Tickets bot. But didn't know rust.
Expand Down Expand Up @@ -43,22 +45,45 @@ Toggle with /setting stripbuttons.

Here are the steps to host your copy of [this bot.](https://github.com/Tech-TTGames/Tickets-Plus)[^6]:

1. Clone or Download the repo to your machine of choice.
2. Run `python -m venv 'virt environment name'` to create an enviroment to avoid dependency conflicts.
3. Invoke `/'venv name here'/scripts/activate` to enter into the enviroment for use.
4. Run (Assuming pip and python are already on the machine) `pip install -r requirements.txt`
5. Create the bot on [Discord Developers](https://discord.com/developers/applications).
1. Open the directory you want the project to be placed in.
2. Use `git clone https://github.com/Tech-TTGames/Tickets-Plus.git` or download and unpack [the repo](https://github.com/Tech-TTGames/Tickets-Plus/archive/refs/heads/main.zip).
3. Ensure that python3.11 is installed and available, same for pip.
4. Run `pip install poetry`.
- Change some poetry settings as-needed. You can add the `--local` flag to set those settings only to the current directory
- `poetry config virtualenvs.in-project true` installs the virtual environment in project not in a poetry-specific location (reccomended).
- `poetry config virtualenvs.create false` if you don't want poetry to use a venv (not reccomended).
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
5. Run `poetry install`
- Depending on DB used add `-E pgsql` or `-E sqlite`
- If you want development packages add `--with dev`
6. Install PostgreSQL. [Guide Here](https://www.postgresql.org/download/)
1. Set up automatic postgres startup [Linux](https://www.postgresql.org/docs/current/server-start.html) and for windows just start it via `services.msc`
2. Set up user and database for bot. `<FIELD>` are required and to be repalced with your own stuff. [FIELD] are optional and can be ignored.
- Linux:
1. `sudo -u postgres -i`
2. `createuser <dbuser> --pwprompt` The prompt will ask you for password for new user - `<dbpass>`.
3. `createdb <dbname> [comment] -E UTF8 -O <dbuser>` - `<dbuser>` being the same as in previous step.
- Windows:
1. If the installed postgres bin isn't in PATH use `cd` to go to the instalaltion bin.
Tech-TTGames marked this conversation as resolved.
Show resolved Hide resolved
2. `createuser <dbuser> --pwprompt -U postgres`. The prompt will ask you for password to postgres and password for new user - `<dbpass>`.
3. `createdb <dbname> [comment] -E UTF8 -O <dbuser> -U postgres` - `<dbuser>` being the same as in previous step.
3. Fill out config.json based on the database config environment. (refer to example_config.json)
- Don't change "dbtype" unless you're using sqlite.
- Unless you are using remote server/changed config don't touch "dbhost" and "dbport".
- Otherwise all parameters are named *here* and in example_config.json the same
7. Create the bot on [Discord Developers](https://discord.com/developers/applications).
1. Create application however you want.
2. Create a bot. Turn on the 'Message Content' privileged intent. Probably disable 'Public Bot'.
3. Input your bot token to secret.json. (Refer to example_secret.json)
4. Use `https://discord.com/api/oauth2/authorize?client_id=<APP_ID>&permissions=397284478096&scope=bot%20applications.commands` to invite the bot. replace `<APP_ID>` with the numbers from your apps `https://discord.com/developers/applications/<APP_ID>/`.
6. Fill out config.json based on the information about your server. (Refer to example_config.json)
7. Start your bot!
1. Probably add a background service that will restart the bot on boot. *I use systemctl for my bots.*
2. Create a bot.
3. Turn on the 'Message Content' privileged intent. Probably disable 'Public Bot'.
4. Input your bot token to secret.json. (Refer to example_secret.json)
5. Invite the bot to your server! Replace the <CLIENT_ID> in the below invites with numbers from `https://discord.com/developers/applications/<CLIENT_ID>/`
- The ***easy link*** - `https://discord.com/api/oauth2/authorize?client_id=<CLIENT_ID>&permissions=8&scope=bot%20applications.commands`
- The *safer link* - `https://discord.com/api/oauth2/authorize?client_id=<CLIENT_ID>&permissions=535059492048&scope=bot%20applications.commands`
8. Start your bot! Use `poetry run start` or after activating venv (if present) `python3 /tickets_plus/`
- Probably add a background service that will restart the bot on boot. *I use systemctl for my bots.*

### Database Documentation

* [Database Documentation](https://tickets-plus.techttgames.dev/database_info.html)
- [Database Documentation](https://tickets-plus.techttgames.dev/database_info.html)

[^1]: This bot is not affiliated with the TicketsBot team. When a feature is added to the main bot any feature that is no longer needed will be discontinued here.
[^0]: [Tech-TTGames](https:\\github.com\Tech-TTGames), I'm the only one here right now. I had some help in general but I'm the only one who has done any coding. More people are welcome to join. I had help with organization and checking my code from [kk5dire](https://github.com/kk5dire) and [Ben Foster](https://github.com/benfoster04) with hosting and some documentation changes.
Expand Down
Loading