Using new repo for lavalink

This commit is contained in:
Mylloon 2021-08-10 09:48:50 +02:00
parent 30e55d4799
commit 0bf4f6315c
4 changed files with 15 additions and 51 deletions

View file

@ -1,5 +1,7 @@
FROM python:3.8.11-slim
ENV DOCKER_KASSOUBOT=True
COPY requirements.txt .
RUN pip install -r requirements.txt

View file

@ -1,48 +0,0 @@
server: # REST and WS server
port: 2333
address: "localhost"
lavalink:
server:
password: "youshallnotpass"
sources:
youtube: true
bandcamp: true
soundcloud: true
twitch: true
vimeo: true
http: true
local: false
bufferDurationMs: 400
youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
playerUpdateInterval: 5 # How frequently to send player updates to clients, in seconds
youtubeSearchEnabled: true
soundcloudSearchEnabled: true
gc-warnings: false
#ratelimit:
#ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
#excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
#strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
#searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
#retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
metrics:
prometheus:
enabled: false
endpoint: /metrics
sentry:
dsn: ""
environment: ""
# tags:
# some_key: some_value
# another_key: another_value
logging:
file:
max-history: 30
max-size: 10MB
path: ./logs/
level:
root: INFO
lavalink: INFO

View file

@ -10,19 +10,24 @@ class Music(commands.Cog):
"""Commandes relatives à la musique."""
def __init__(self, client):
self.client = client
self.keys = load(["REGION_DISCORD"])
self.keys = load(["REGION_DISCORD", "DOCKER"])
if not hasattr(client, 'wavelink'):
self.client.wavelink = wClient(bot = self.client)
if self.keys["DOCKER_KASSOUBOT"] == True:
self.url = "url docker"
else:
self.url = "localhost"
self.client.loop.create_task(self.start_nodes())
async def start_nodes(self):
await self.client.wait_until_ready()
await self.client.wavelink.initiate_node(host = "localhost",
await self.client.wavelink.initiate_node(host = f"{self.url}",
port = 2333,
rest_uri = "http://localhost:2333",
rest_uri = f"http://{self.url}:2333",
password = "youshallnotpass",
identifier = "PROD",
region = self.keys["REGION_DISCORD"])

View file

@ -172,6 +172,11 @@ def load(variables):
for var in variables:
try:
res = environ[var]
if var == "DOCKER_KASSOUBOT": # check is VERBOSE is set
try:
res = bool(environ[var])
except:
res = False # if not its False
if var == "DEACTIVATE":
res = list(set(res.split(',')) - {""}) # create a list for the cogs we need to deactivate and remove blank channels and doubles
keys[var] = res