-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Category: Cogs - AudioThis is related to the Audio cog.This is related to the Audio cog.Category: Docs - User GuidesThis is related to user guides (excluding cog guides).This is related to user guides (excluding cog guides).Status: Needs TriageThis has not been labeled or discussed for handling yet.This has not been labeled or discussed for handling yet.Type: EnhancementSomething meant to enhance existing Red features.Something meant to enhance existing Red features.
Description
What component of Red (cog, command, API) would you like to see improvements on?
Audio (unmanaged lavalink instance)
Describe the enhancement you're suggesting.
I've been using Red for a few years now, and as of the last 1-2 years, I've noticed that the application.yml constantly needs updating for lavalink. This can be a headache if you are running an unmanaged instance of lavalink. I have two proposals, of how to fix this, both with logging. This would be an update to auto_update.sh mentioned in the docs.
Option 1:
#!/bin/bash
set -e
cd "$(dirname "$0")"
LOGFILE="./auto_update.log"
echo "[$(date)] --- Starting Lavalink auto-update ---" >> "$LOGFILE"
# Download Lavalink if newer
echo "[$(date)] Checking Lavalink.jar..." >> "$LOGFILE"
curl -s -LOz Lavalink.jar https://github.com/Cog-Creators/Lavalink-Jars/releases/latest/download/Lavalink.jar && \
echo "[$(date)] Lavalink.jar checked/downloaded." >> "$LOGFILE"
# Get latest version from GitHub API
LATEST_VERSION=$(curl -s https://api.github.com/repos/Cog-Creators/Red-DiscordBot/releases/latest | grep '"tag_name":' | cut -d '"' -f4)
# Build YML URL
YML_URL="https://github.com/Cog-Creators/Red-DiscordBot/releases/download/${LATEST_VERSION}/Red-DiscordBot-${LATEST_VERSION}-default-lavalink-application.yml"
echo "[$(date)] Fetching application.yml from $YML_URL" >> "$LOGFILE"
curl -s -L -o application.yml "$YML_URL" && \
echo "[$(date)] application.yml updated to ${LATEST_VERSION}" >> "$LOGFILE"
echo "[$(date)] --- Update complete ---" >> "$LOGFILE"Option 2:
#!/bin/bash
set -e
cd "$(dirname "$0")"
LOGFILE="./auto_update.log"
echo "[$(date)] --- Starting Lavalink & plugin auto-update ---" >> "$LOGFILE"
# Download Lavalink if it's newer
echo "[$(date)] Checking for updated Lavalink.jar..." | tee -a "$LOGFILE"
curl -s -LOz Lavalink.jar https://github.com/Cog-Creators/Lavalink-Jars/releases/latest/download/Lavalink.jar && \
echo "[$(date)] Lavalink.jar checked/downloaded." | tee -a "$LOGFILE"
# Get the latest YouTube plugin version
LATEST_PLUGIN_VERSION=$(curl -s "https://maven.lavalink.dev/releases/dev/lavalink/youtube/youtube-plugin/maven-metadata.xml" | grep '<latest>' | sed -E 's/.*<latest>([^<]+)<\/latest>.*/\1/')
YML_FILE="./application.yml"
if [[ -n "$LATEST_PLUGIN_VERSION" ]]; then
echo "[$(date)] Found latest plugin version: $LATEST_PLUGIN_VERSION" | tee -a "$LOGFILE"
CURRENT_VERSION=$(grep -oP 'dev.lavalink.youtube:youtube-plugin:\K[0-9.]+' "$YML_FILE" || echo "none")
if [[ "$CURRENT_VERSION" != "$LATEST_PLUGIN_VERSION" ]]; then
echo "[$(date)] Updating plugin version from $CURRENT_VERSION to $LATEST_PLUGIN_VERSION" | tee -a "$LOGFILE"
sed -i "s|dev.lavalink.youtube:youtube-plugin:.*|dev.lavalink.youtube:youtube-plugin:${LATEST_PLUGIN_VERSION}|" "$YML_FILE"
echo "[$(date)] application.yml updated." | tee -a "$LOGFILE"
else
echo "[$(date)] Plugin version already up-to-date ($CURRENT_VERSION)." | tee -a "$LOGFILE"
fi
else
echo "[$(date)] Failed to retrieve latest plugin version!" | tee -a "$LOGFILE"
fi
echo "[$(date)] --- Update complete ---" | tee -a "$LOGFILE"```Metadata
Metadata
Assignees
Labels
Category: Cogs - AudioThis is related to the Audio cog.This is related to the Audio cog.Category: Docs - User GuidesThis is related to user guides (excluding cog guides).This is related to user guides (excluding cog guides).Status: Needs TriageThis has not been labeled or discussed for handling yet.This has not been labeled or discussed for handling yet.Type: EnhancementSomething meant to enhance existing Red features.Something meant to enhance existing Red features.