<,<
This commit is contained in:
parent
8f8ff6aa81
commit
4d5c301c46
@ -8,14 +8,12 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "2333:2333"
|
- "2333:2333"
|
||||||
environment:
|
environment:
|
||||||
LAVALINK_SERVER_PASSWORD: ${LAVALINK_PASSWORD}
|
- LAVALINK_SERVER_PASSWORD=${LAVALINK_PASSWORD}
|
||||||
# Add environment variable for plugin URLs (using the format you provided)
|
# Removed LAVALINK_PLUGIN_URLS environment variable
|
||||||
LAVALINK_PLUGIN_URLS: |
|
|
||||||
https://github.com/lavalink-devs/youtube-source/releases/download/1.12.0/youtube-plugin-1.12.0.jar
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./application.yml:/opt/Lavalink/application.yml:ro,Z
|
- ./application.yml:/opt/Lavalink/application.yml:ro,Z
|
||||||
# Optional: Persist downloaded plugins if needed, though downloading on start is fine
|
# Mount local plugins directory into the container
|
||||||
# - lavalink-plugins:/plugins
|
- ./plugins:/plugins:ro
|
||||||
# Add healthcheck to verify Lavalink is ready
|
# Add healthcheck to verify Lavalink is ready
|
||||||
healthcheck:
|
healthcheck:
|
||||||
# Use CMD-SHELL to allow environment variable expansion for the password
|
# Use CMD-SHELL to allow environment variable expansion for the password
|
||||||
@ -24,22 +22,7 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 15s # Give Lavalink time to start up initially
|
start_period: 15s # Give Lavalink time to start up initially
|
||||||
# Override entrypoint/command to download plugins first
|
# Removed command override, will use default image entrypoint
|
||||||
command: >
|
|
||||||
sh -c "
|
|
||||||
apk add --no-cache curl && \
|
|
||||||
mkdir -p /plugins && \
|
|
||||||
echo 'Downloading Lavalink plugins...' && \
|
|
||||||
echo \"$$LAVALINK_PLUGIN_URLS\" | while IFS= read -r url; do \
|
|
||||||
if [ -n \"$$url\" ]; then \
|
|
||||||
filename=$(basename \"$$url\") && \
|
|
||||||
echo \"Downloading $$url to /plugins/$$filename\" && \
|
|
||||||
curl -L -o \"/plugins/$$filename\" \"$$url\"; \
|
|
||||||
fi \
|
|
||||||
done && \
|
|
||||||
echo 'Downloads complete. Starting Lavalink...' && \
|
|
||||||
java -jar Lavalink.jar
|
|
||||||
"
|
|
||||||
|
|
||||||
bot:
|
bot:
|
||||||
build: .
|
build: .
|
||||||
|
|||||||
@ -25,18 +25,19 @@ class MusicPlayer {
|
|||||||
return this.players.get(guildId);
|
return this.players.get(guildId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Shoukaku node
|
// Get Shoukaku instance and node
|
||||||
const node = this.client.shoukaku.options.nodeResolver(this.client.shoukaku.nodes);
|
const shoukaku = this.client.shoukaku; // Get the main shoukaku instance
|
||||||
|
const node = shoukaku.options.nodeResolver(shoukaku.nodes);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
throw new Error('No available Lavalink nodes!');
|
throw new Error('No available Lavalink nodes!');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create a new connection to the voice channel
|
// Create a new connection to the voice channel using the shoukaku instance
|
||||||
const connection = await this.client.shoukaku.joinVoiceChannel({
|
const connection = await shoukaku.joinVoiceChannel({
|
||||||
guildId: guildId,
|
guildId: guildId,
|
||||||
channelId: voiceChannel,
|
channelId: voiceChannel,
|
||||||
shardId: 0,
|
shardId: 0, // Assuming shardId 0, adjust if sharding
|
||||||
deaf: true
|
deaf: true
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,10 +101,12 @@ class MusicPlayer {
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
shoukaku: shoukaku, // Store shoukaku instance on the player object
|
||||||
|
|
||||||
// Destroy the player and disconnect
|
// Destroy the player and disconnect
|
||||||
destroy() {
|
destroy() {
|
||||||
// Use the main Shoukaku instance to leave the channel
|
// Use the stored Shoukaku instance to leave the channel
|
||||||
this.client.shoukaku.leaveVoiceChannel(this.guild);
|
this.shoukaku.leaveVoiceChannel(this.guild);
|
||||||
// Remove the player instance from the manager's map
|
// Remove the player instance from the manager's map
|
||||||
musicPlayer.players.delete(this.guild);
|
musicPlayer.players.delete(this.guild);
|
||||||
logger.debug(`Destroyed player for guild ${this.guild}`);
|
logger.debug(`Destroyed player for guild ${this.guild}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user