diff --git a/README.md b/README.md index 7b496e7..bbbb029 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Bot developed with [discord.py](https://github.com/Rapptz/discord.py) (rewrite) - FRENCH +# Bot Discord [![Version](https://img.shields.io/badge/version-1.5-green?style=for-the-badge)](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/-/releases) [![Build](https://img.shields.io/gitlab/pipeline/ConfrerieDuKassoulait/KassouBot/dev?style=for-the-badge)](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/container_registry) @@ -23,6 +23,8 @@ docker run -d \ 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* @@ -37,8 +39,10 @@ To find Genius token, go to [this site](https://genius.com/api-clients), `login ## __Features__ +- Using [discord.py](https://github.com/Rapptz/discord.py) (rewrite) - Everything is explained by doing the `help` command. -- Using SQLite for the database. +- 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). ## __Launching locally__ If you want to run it without Docker, create an .env file to store variables in the root folder (there is an example [here](https://gitlab.com/ConfrerieDuKassoulait/KassouBot/-/blob/main/.envexample)). diff --git a/src/cogs/music.py b/src/cogs/music.py index a7107ff..88c1c65 100644 --- a/src/cogs/music.py +++ b/src/cogs/music.py @@ -3,6 +3,7 @@ from subprocess import Popen, DEVNULL from wavelink import Client as wClient from discord.ext import commands from time import sleep +from utils.core import load def setup(client): client.add_cog(Music(client)) @@ -12,6 +13,7 @@ class Music(commands.Cog): def __init__(self, client): self.client = client print("DĂ©marrage du serveur Lavalink...", end = " ") + self.keys = load(["REGION_DISCORD"]) Popen(['java', '-jar', 'Lavalink.jar'], stdout = DEVNULL) print("Lavalink prĂȘt") @@ -29,7 +31,7 @@ class Music(commands.Cog): rest_uri = "http://127.0.0.1:2333", password = "youshallnotpass", identifier = "PROD", - region = "eu_west") + region = self.keys["REGION_DISCORD"]) @commands.command(name='connect') async def connect_(self, ctx, *, channel: discord.VoiceChannel = None): diff --git a/src/utils/core.py b/src/utils/core.py index 7000f9f..b66fba1 100644 --- a/src/utils/core.py +++ b/src/utils/core.py @@ -178,6 +178,8 @@ def load(variables): except KeyError: if var == "DEACTIVATE": keys[var] = "None" + elif var == "REGION_DISCORD": + keys[var] = "eu_west" else: print(f"Please set the environment variable {var} (.env file supported)") exit(1)