This repository has been archived on 2022-06-13. You can view files and clone it, but cannot push or open issues or pull requests.
KassouBot/README.md

84 lines
4.6 KiB
Markdown
Raw Normal View History

# Bot Discord
2020-11-29 11:50:51 +01:00
2021-08-16 20:54:53 +02:00
[![Version](https://img.shields.io/badge/version-1.6-green?style=for-the-badge)](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/-/releases)
2021-07-28 01:29:59 +02:00
[![Build](https://img.shields.io/gitlab/pipeline/ConfrerieDuKassoulait/KassouBot/dev?style=for-the-badge)](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/container_registry)
2021-03-17 22:14:11 +01:00
## __Setting up__
2020-11-29 11:50:51 +01:00
You have to replace `TOKEN_DISCORD`, `PREFIX`, `TOKEN_GENIUS`, `TOKEN_REDDIT_CLIENT_ID`, `TOKEN_REDDIT_CLIENT_SECRET`, `TOKEN_REDDIT_USER_AGENT` and [`TIMEZONE`](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) with your desired values. You must also specify a path to the folder where the database will be.
2021-03-17 21:36:01 +01:00
2021-08-14 20:40:45 +02:00
With a [docker-compose](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/-/blob/main/docker-compose.yml) or in command line:
First we need to create a dedicated network for our containers:
2021-08-16 22:38:39 +02:00
On Debian-based distro:
```batch
docker network create -d bridge default-kassoubot 2> /dev/null || true
2021-03-17 21:36:01 +01:00
```
On Windows:
```batch
docker network create -d bridge default-kassoubot 2> NUL || REM
```
Then we can create our containers:
```batch
2021-08-14 16:08:08 +02:00
docker run -d \
--name="Lavalink" \
-p 2333:2333 \
2021-08-16 18:45:53 +02:00
--network="default-kassoubot" \
2021-08-14 16:08:08 +02:00
--restart=unless-stopped \
2021-08-16 18:45:53 +02:00
registry.gitlab.com/confreriedukassoulait/lavalink:latest \
lavalink \
2021-08-14 16:08:08 +02:00
&& \
2021-03-17 21:36:01 +01:00
docker run -d \
2021-03-28 14:41:34 +02:00
--name="KassouBot" \
2021-08-16 18:45:53 +02:00
-e TOKEN_DISCORD="yourTokenDiscord" \
-e TOKEN_GENIUS="yourTokenGenius" \
-e TOKEN_REDDIT_CLIENT_ID="yourRedditClientID" \
-e TOKEN_REDDIT_CLIENT_SECRET="yourRedditClientSecret" \
-e TOKEN_REDDIT_USER_AGENT="yourRedditUserAgent" \
-e TIMEZONE="yourTimezone" \
-e PREFIX="yourPrefix" \
2021-08-15 12:24:18 +02:00
-v /here/your/path/:/opt/db \
2021-08-16 18:45:53 +02:00
--network="default-kassoubot" \
2021-08-14 16:08:08 +02:00
--restart=unless-stopped
2021-08-16 18:45:53 +02:00
registry.gitlab.com/confreriedukassoulait/kassoubot \
2021-03-17 21:36:01 +01:00
```
- You shouldn't change at least the service name of the Lavalink container because the bot is using his DNS name (and it's based on the service's name).
- You can add the environment variable `DEACTIVATE` to disable some cogs (separate the cogs with commas and no spaces between).
- You can add the environment variable `REGION_DISCORD` to force the Lavalink server to use your voice region.
To find reddit tokens, go to [this site](https://www.reddit.com/prefs/apps) and here are the instructions: ![instructions](https://i.imgur.com/tEzYKDA.png)
*redirection uri (for copy/paste) : http://localhost:8080*
2020-11-29 11:50:51 +01:00
To find Genius token, go to [this site](https://genius.com/api-clients), `login to your account` and on the left select `New API Client`. Fill the field with what you want then click `Save`. Now your token is the `CLIENT ACCESS TOKEN`.
2021-03-17 22:14:11 +01:00
## __Add the bot to your server__
2020-11-29 11:50:51 +01:00
- In the [Discord Dev Portal](https://discord.com/developers/applications) create an application, and make sure it's a `Bot` (third tab).
- To invite it, go to the `OAuth2` (second tab) tab, select the scopes `bot` (required) and `applications.commands` (for the slashs commands) and in the bot permissions select `Administrator` (You can select manually at your own risk).
2021-06-03 09:08:50 +02:00
- You have the link to copy above between the two blocks `scopes` and `permissions`.
2021-05-30 13:54:34 +02:00
- If you need help, you can [join my Discord](https://discord.gg/Z5ePxH4).
2020-11-29 11:50:51 +01:00
## __Features__
- Using [discord.py](https://github.com/Rapptz/discord.py) (rewrite)
2021-06-03 12:20:29 +02:00
- Everything is explained by doing the `help` command.
- Using [SQLite](https://www.sqlite.org/index.html) for the database.
- Using [Lavalink](https://github.com/freyacodes/Lavalink) with a [Wavelink client](https://github.com/PythonistaGuild/Wavelink).
2021-06-03 09:08:50 +02:00
2021-06-03 09:10:58 +02:00
## __Launching locally__
2021-08-15 13:04:34 +02:00
If you want to run it without Docker, clone the repo (and his submodules by doing `git submodule update --force --recursive --init --remote` in the git folder) then create an .env file to store variables in the root folder (there is an example [here](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/-/blob/main/.envexample)).
2021-08-07 11:05:19 +02:00
Install all the requirements by doing `python3 -m pip install -r requirements.txt`.
2021-08-16 22:38:39 +02:00
If you need to install Java, there is some step to have the same as the [Docker image built for the project](https://gitlab.com/ConfrerieDuKassoulait/lavalink/), on Debian-based distro:
2021-08-15 14:53:04 +02:00
```bash
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
sudo apt update -y
sudo apt install adoptopenjdk-16-openj9 -y
```
2021-08-16 22:38:39 +02:00
On Windows just go [to their site](https://adoptopenjdk.net/?variant=openjdk16&jvmVariant=openj9).
2021-08-15 14:53:04 +02:00
2021-08-16 22:38:39 +02:00
Then, simply run `start.bat` if you are on Windows or `start.sh` if on Debian-based distro to launch the bot.