From 1c72dacb72cf0824c231408774ab921d18e047e1 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 11 Feb 2023 12:52:16 +0100 Subject: [PATCH 01/11] refactor(client): Build cadency with builder Close #87 --- cadency/src/main.rs | 11 +- cadency_core/src/client.rs | 121 +++++++----------- cadency_core/src/error.rs | 4 +- .../examples/custom_commands.rs | 10 +- 4 files changed, 60 insertions(+), 86 deletions(-) diff --git a/cadency/src/main.rs b/cadency/src/main.rs index f0ff492..3b3d37d 100644 --- a/cadency/src/main.rs +++ b/cadency/src/main.rs @@ -27,11 +27,12 @@ async fn main() { Tracks::default(), Urban::default(), ]; - let mut cadency = Cadency::default() - .await - .expect("To init Cadency") - .with_commands(commands) - .await; + let cadency = Cadency::builder() + .token(std::env::var("DISCORD_TOKEN").expect("Discord token to be present")) + .commands(commands) + .build() + .expect("To build cadency"); + if let Err(why) = cadency.start().await { error!("Client error: {:?}", why); } diff --git a/cadency_core/src/client.rs b/cadency_core/src/client.rs index ac15d00..1a49385 100644 --- a/cadency_core/src/client.rs +++ b/cadency_core/src/client.rs @@ -2,105 +2,78 @@ use crate::{ command::Commands, error::CadencyError, handler::command::Handler, intents::CadencyIntents, CadencyCommand, }; -use serenity::client::Client; +use serenity::{client::Client, model::gateway::GatewayIntents}; use songbird::SerenityInit; -#[cfg(not(test))] -use std::env; use std::sync::Arc; -#[cfg_attr(test, mockall::automock)] -mod env_read { - #[allow(dead_code)] - pub fn var(_env_name: &str) -> Result { - Ok(String::from("SOME_ENV_VALUE")) - } -} - -#[cfg(test)] -use mock_env_read as env; - -pub const DISCORD_TOKEN_ENV: &str = "DISCORD_TOKEN"; - +#[derive(derive_builder::Builder)] pub struct Cadency { - client: serenity::Client, + token: String, + #[builder(default)] + commands: Vec>, + #[builder(default = "CadencyIntents::default().into()")] + intents: GatewayIntents, } -#[cfg_attr(test, mockall::automock)] impl Cadency { - /// Construct the Cadency discord but with default configuration - pub async fn default() -> Result { - let token = env::var(DISCORD_TOKEN_ENV) - .map_err(|_| CadencyError::Environment(DISCORD_TOKEN_ENV.to_string()))?; - Self::new(token).await + pub fn builder() -> CadencyBuilder { + CadencyBuilder::default() } - /// Construct the Cadency discord bot with a custom token that can be set programmatically - /// - /// # Arguments - /// * `token` - The discord bot token as string - pub async fn new(token: String) -> Result { - let client = Client::builder(token, CadencyIntents::default().into()) + /// This will actually start the configured Cadency bot + pub async fn start(self) -> Result<(), CadencyError> { + let mut client = Client::builder(self.token, self.intents) .event_handler(Handler) .register_songbird() .await - .map_err(|err| CadencyError::Builder { source: err })?; - Ok(Self { client }) - } - - /// This will register and provide the commands for cadency. - /// Every struct that implements the CadencyCommand trait can be used. - pub async fn with_commands(self, commands: Vec>) -> Self { + .map_err(|err| CadencyError::Start { source: err })?; { - let mut data = self.client.data.write().await; - data.insert::(commands); + let mut data = client.data.write().await; + data.insert::(self.commands); } - self - } - - /// This will actually start the configured Cadency bot - pub async fn start(&mut self) -> Result<(), serenity::Error> { - self.client.start().await + client + .start() + .await + .map_err(|err| CadencyError::Start { source: err }) } } #[cfg(test)] mod test { use super::*; - use std::sync::{Mutex, MutexGuard}; - static MTX: Mutex<()> = Mutex::new(()); - - // When a test panics, it will poison the Mutex. Since we don't actually - // care about the state of the data we ignore that it is poisoned and grab - // the lock regardless. If you just do `let _m = &MTX.lock().unwrap()`, one - // test panicking will cause all other tests that try and acquire a lock on - // that Mutex to also panic. - fn get_lock(m: &'static Mutex<()>) -> MutexGuard<'static, ()> { - match m.lock() { - Ok(guard) => guard, - Err(poisoned) => poisoned.into_inner(), - } + #[test] + fn fail_to_build_without_token() { + let build = Cadency::builder().commands(vec![]).build(); + assert!(build.is_err()) } - #[tokio::test] - async fn should_error_on_missing_env_token() { - let _m = get_lock(&MTX); - - let env_cxt = mock_env_read::var_context(); - env_cxt.expect().return_once(|_| Err(())); - let cadency = Cadency::default().await; - assert!(cadency.is_err()); + #[test] + fn build_with_token() { + let build = Cadency::builder() + .commands(vec![]) + .token("some-token".to_string()) + .build(); + assert!(build.is_ok()) } - #[tokio::test] - async fn should_build_cadency_with_env_token() { - let _m = get_lock(&MTX); + #[test] + fn build_with_default_intents() { + let build = Cadency::builder() + .commands(vec![]) + .token("some-token".to_string()) + .build() + .unwrap(); + assert_eq!(build.intents, CadencyIntents::default().into()); + } - let env_cxt = mock_env_read::var_context(); - env_cxt - .expect() - .return_once(|_| Ok(String::from("ENV_VAR_VALUE"))); - let test = Cadency::default().await; - assert!(test.is_ok()) + #[test] + fn build_with_empty_commands() { + let build = Cadency::builder() + .commands(vec![]) + .token("some-token".to_string()) + .build() + .unwrap(); + assert!(build.commands.is_empty()); } } diff --git a/cadency_core/src/error.rs b/cadency_core/src/error.rs index 0163afb..7dc9d02 100644 --- a/cadency_core/src/error.rs +++ b/cadency_core/src/error.rs @@ -5,8 +5,8 @@ use thiserror::Error; pub enum CadencyError { #[error("Missing environment variable '{0}'")] Environment(String), - #[error("Failed to build cadency bot")] - Builder { source: serenity::Error }, + #[error("Failed to start cadency")] + Start { source: serenity::Error }, #[error("Failed to join a voice channel")] Join, #[error("Response failed")] diff --git a/examples/custom_commands/examples/custom_commands.rs b/examples/custom_commands/examples/custom_commands.rs index 32e987c..0ad54ce 100644 --- a/examples/custom_commands/examples/custom_commands.rs +++ b/examples/custom_commands/examples/custom_commands.rs @@ -59,12 +59,12 @@ async fn main() { let commands = setup_commands![Fib::default(), Hello::default()]; // Init cadency with a valid discord bot token - let mut cadency = Cadency::new("".to_string()) - .await - .expect("To init cadency") + let cadency = Cadency::builder() + .token("".to_string()) // Add the commands array to cadency - .with_commands(commands) - .await; + .commands(commands) + .build() + .expect("To build cadency"); // Start cadency - this will submit and register the commands to discord if let Err(why) = cadency.start().await { From 5b19dd206439d1a44c07938559b604542b75a7d7 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:15:18 +0100 Subject: [PATCH 02/11] chore(cargo): Move to workspace dependencies --- Cargo.toml | 25 +++++++++++++++++++++++++ cadency/Cargo.toml | 9 +++------ cadency_commands/Cargo.toml | 28 ++++++---------------------- cadency_core/Cargo.toml | 28 +++++++--------------------- cadency_yt_playlist/Cargo.toml | 8 +++----- examples/custom_commands/Cargo.toml | 15 ++++----------- 6 files changed, 48 insertions(+), 65 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fe00f9f..9299d76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,28 @@ members = [ "cadency", "examples/*" ] + +[workspace.dependencies] +env_logger = "0.10.0" +log = "0.4.17" +reqwest = "0.11.14" +thiserror = "1.0.38" +serde_json = "1.0.91" +derive_builder = "0.12.0" + +[workspace.dependencies.serenity] +version = "0.11.5" +default-features = false +features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"] + +[workspace.dependencies.songbird] +version = "0.3.0" +features = ["builtin-queue", "yt-dlp"] + +[workspace.dependencies.tokio] +version = "1.25.0" +features = ["macros", "rt-multi-thread"] + +[workspace.dependencies.serde] +version = "1.0.152" +features = ["derive"] \ No newline at end of file diff --git a/cadency/Cargo.toml b/cadency/Cargo.toml index 6ba82af..0a7b312 100644 --- a/cadency/Cargo.toml +++ b/cadency/Cargo.toml @@ -9,8 +9,9 @@ repository = "https://github.com/jontze/cadency-rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -env_logger = "0.10.0" -log = "0.4.17" +env_logger = { workspace = true } +log = { workspace = true } +tokio = { workspace = true } [dependencies.cadency_core] path = "../cadency_core" @@ -19,7 +20,3 @@ version = "0.3.1" [dependencies.cadency_commands] path = "../cadency_commands" version = "0.3.1" - -[dependencies.tokio] -version = "1.25.0" -features = ["macros", "rt-multi-thread"] diff --git a/cadency_commands/Cargo.toml b/cadency_commands/Cargo.toml index 9a90ffb..317053e 100644 --- a/cadency_commands/Cargo.toml +++ b/cadency_commands/Cargo.toml @@ -9,21 +9,12 @@ repository = "https://github.com/jontze/cadency-rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -reqwest = "0.11.14" - -[dependencies.serde] -version = "1.0.152" -features = ["derive"] - -[dependencies.serenity] -version = "0.11.5" -default-features = false -features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"] - -[dependencies.songbird] -version = "0.3.0" -features = ["builtin-queue", "yt-dlp"] +log = { workspace = true } +serenity = { workspace = true } +songbird = { workspace = true } +tokio = { workspace = true } +reqwest = { workspace = true } +serde = { workspace = true } [dependencies.cadency_core] path = "../cadency_core" @@ -36,10 +27,3 @@ version = "0.3.1" [dependencies.cadency_yt_playlist] path = "../cadency_yt_playlist" version = "0.3.1" - -[dev-dependencies.tokio] -version = "1.25.0" -features = ["macros", "rt-multi-thread"] - - - diff --git a/cadency_core/Cargo.toml b/cadency_core/Cargo.toml index 01d8374..02eb581 100644 --- a/cadency_core/Cargo.toml +++ b/cadency_core/Cargo.toml @@ -7,24 +7,10 @@ license = "MIT" repository = "https://github.com/jontze/cadency-rs" [dependencies] -log = "0.4.17" -reqwest = "0.11.14" -thiserror = "1.0.38" -mockall_double = "0.3.0" -derive_builder = "0.12.0" - -[dependencies.serenity] -version = "0.11.5" -default-features = false -features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"] - -[dependencies.songbird] -version = "0.3.0" -features = ["builtin-queue", "yt-dlp"] - -[dev-dependencies] -mockall = "0.11.3" - -[dev-dependencies.tokio] -version = "1.25.0" -features = ["macros", "rt-multi-thread"] +log = { workspace = true } +serenity = { workspace = true } +songbird = { workspace = true } +tokio = { workspace = true } +reqwest = { workspace = true } +thiserror = { workspace = true } +derive_builder = { workspace = true } diff --git a/cadency_yt_playlist/Cargo.toml b/cadency_yt_playlist/Cargo.toml index 330c1ae..1bfb390 100644 --- a/cadency_yt_playlist/Cargo.toml +++ b/cadency_yt_playlist/Cargo.toml @@ -9,9 +9,7 @@ repository = "https://github.com/jontze/cadency-rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde_json = "1.0.91" -thiserror = "1.0.38" +serde_json = { workspace = true } +thiserror = { workspace = true } +serde = { workspace = true } -[dependencies.serde] -version = "1.0.152" -features = ["derive"] diff --git a/examples/custom_commands/Cargo.toml b/examples/custom_commands/Cargo.toml index 1e326f7..ea9ccdd 100644 --- a/examples/custom_commands/Cargo.toml +++ b/examples/custom_commands/Cargo.toml @@ -12,13 +12,10 @@ repository = "https://github.com/jontze/cadency-rs" name = "custom_commands" [dependencies] -env_logger = "0.10.0" -log = "0.4.17" - -[dependencies.serenity] -version = "0.11.5" -default-features = false -features = ["client", "gateway", "rustls_backend", "model", "voice", "cache"] +serenity = { workspace = true } +tokio = { workspace = true } +env_logger = { workspace = true } +log = { workspace = true } [dependencies.cadency_core] path = "../../cadency_core" @@ -31,7 +28,3 @@ version = "0.3.1" [dependencies.cadency_commands] path = "../../cadency_commands" version = "0.3.1" - -[dependencies.tokio] -version = "1.25.0" -features = ["macros", "rt-multi-thread"] From f7ae7a704885507800b0c5891ba652b3b44188d4 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Fri, 24 Feb 2023 17:12:57 +0100 Subject: [PATCH 03/11] chore(yt-dlp): Save currently used yt-dlp version --- .yt-dlprc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .yt-dlprc diff --git a/.yt-dlprc b/.yt-dlprc new file mode 100644 index 0000000..1ea250c --- /dev/null +++ b/.yt-dlprc @@ -0,0 +1 @@ +2023.02.17 \ No newline at end of file From 372eca0574506836f211d2ac33b91ccf6b067352 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Fri, 24 Feb 2023 19:42:37 +0100 Subject: [PATCH 04/11] chore(docker): Update rust version --- Dockerfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd22671..e4e5270 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM lukemathwalker/cargo-chef:latest-rust-1.62 as planner +FROM lukemathwalker/cargo-chef:latest-rust-1.67 as planner WORKDIR /cadency COPY . . RUN cargo chef prepare --recipe-path recipe.json -FROM lukemathwalker/cargo-chef:latest-rust-1.62 as cacher +FROM lukemathwalker/cargo-chef:latest-rust-1.67 as cacher WORKDIR /cadency COPY --from=planner /cadency/recipe.json recipe.json RUN apt-get update && apt-get install -y cmake && apt-get autoremove -y && \ -cargo chef cook --release --recipe-path recipe.json + cargo chef cook --release --recipe-path recipe.json -FROM lukemathwalker/cargo-chef:latest-rust-1.62 as builder +FROM lukemathwalker/cargo-chef:latest-rust-1.67 as builder WORKDIR /cadency COPY . . COPY --from=cacher /cadency/target target @@ -24,26 +24,26 @@ WORKDIR packages # If statement: converts architecture from docker to a correct link. Default is amd64 = desktop 64 bit ARG TARGETARCH RUN if [ "$TARGETARCH" = "arm64" ]; then \ - export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz"; \ + export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz"; \ else \ - export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz"; \ + export LINK="https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz"; \ fi && \ apt-get update && apt-get install -y curl tar xz-utils && \ -curl -L $LINK > ffmpeg.tar.xz && \ -tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz + curl -L $LINK > ffmpeg.tar.xz && \ + tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && chmod +x yt-dlp FROM bitnami/minideb:bullseye as python-builder # Based on: https://github.com/zarmory/docker-python-minimal/blob/master/Dockerfile # Removes Python build and developmenttools like pip. RUN apt-get update && apt-get install -y python3-minimal binutils && \ -rm -rf /usr/local/lib/python*/ensurepip && \ -rm -rf /usr/local/lib/python*/idlelib && \ -rm -rf /usr/local/lib/python*/distutils/command && \ -rm -rf /usr/local/lib/python*/lib2to2 && \ -rm -rf /usr/local/lib/python*/__pycache__/* && \ -find /usr/local/bin -not -name 'python*' \( -type f -o -type l \) -exec rm {} \;&& \ -rm -rf /usr/local/share/* + rm -rf /usr/local/lib/python*/ensurepip && \ + rm -rf /usr/local/lib/python*/idlelib && \ + rm -rf /usr/local/lib/python*/distutils/command && \ + rm -rf /usr/local/lib/python*/lib2to2 && \ + rm -rf /usr/local/lib/python*/__pycache__/* && \ + find /usr/local/bin -not -name 'python*' \( -type f -o -type l \) -exec rm {} \;&& \ + rm -rf /usr/local/share/* FROM bitnami/minideb:bullseye LABEL org.opencontainers.image.source="https://github.com/jontze/cadency-rs" From 7db435d6582449cc3145c5e2d7d84ace7bd61d1e Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Fri, 24 Feb 2023 20:18:30 +0100 Subject: [PATCH 05/11] fix(docker): Use yt-dlp version defined in version control --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4e5270..c8d21af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,8 @@ RUN cargo build --release --bin cadency FROM bitnami/minideb:bullseye as packages # Downloads both ffmpeg and yt-dlp -WORKDIR packages +WORKDIR /packages +COPY --from=builder /cadency/.yt-dlprc . # tar: (x) extract, (J) from .xz, (f) a file. (--wildcards */bin/ffmpeg) any path with /bin/ffmpeg, (--transform) remove all previous paths # FFMPEG is staticly compiled, so platform specific # If statement: converts architecture from docker to a correct link. Default is amd64 = desktop 64 bit @@ -31,7 +32,8 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \ apt-get update && apt-get install -y curl tar xz-utils && \ curl -L $LINK > ffmpeg.tar.xz && \ tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz -RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux > yt-dlp && chmod +x yt-dlp +RUN YTDLP_VERSION=$(cat .yt-dlprc) && \ + curl -L https://github.com/yt-dlp/yt-dlp/releases/download/$YTDLP_VERSION/yt-dlp_linux > yt-dlp && chmod +x yt-dlp FROM bitnami/minideb:bullseye as python-builder # Based on: https://github.com/zarmory/docker-python-minimal/blob/master/Dockerfile From 89670ca3cf0b480e3d90db5b612f9730bc621fbf Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 11:59:29 +0100 Subject: [PATCH 06/11] chore(workflows): Scheduled check if yt-dlp is up to date --- .github/workflows/scheduled_yt-dlp_check.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/scheduled_yt-dlp_check.yaml diff --git a/.github/workflows/scheduled_yt-dlp_check.yaml b/.github/workflows/scheduled_yt-dlp_check.yaml new file mode 100644 index 0000000..f641910 --- /dev/null +++ b/.github/workflows/scheduled_yt-dlp_check.yaml @@ -0,0 +1,48 @@ +name: Yt-dlp Updater +on: + workflow_dispatch: + schedule: + - cron: 57 7 * * * # At 07:57 on every day + +jobs: + check: + name: Check Latest Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.latest.outputs.release }} + isNew: ${{ steps.summary.outputs.isNew }} + steps: + - uses: actions/checkout@v3 + - name: Read current Yt-dlp Version + id: current + run: | + echo "version=$(cat .yt-dlprc)" >> $GITHUB_OUTPUT + - name: Latest Release + id: latest + uses: pozetroninc/github-action-get-latest-release@v0.7.0 + with: + repo: yt-dlp + owner: yt-dlp + - name: Summary + id: summary + run: | + echo "# Yt-dlp Version Check" >> $GITHUB_STEP_SUMMARY + echo "The **currently** used yt-dlp version is \`${{ steps.current.outputs.version }}\`." >> $GITHUB_STEP_SUMMARY + echo "The **latest** yt-dlp version is \`${{ steps.latest.outputs.release }}\`." >> $GITHUB_STEP_SUMMARY + if [ "${{ steps.current.outputs.version }}" = "${{ steps.latest.outputs.release }}" ]; then + echo "isNew=false" >> $GITHUB_OUTPUT + echo "The version is up to date. No update was triggered" >> $GITHUB_STEP_SUMMARY + else + echo "isNew=true" >> $GITHUB_OUTPUT + echo "A new version is available. An update was triggered." >> $GITHUB_STEP_SUMMARY + fi + + update: + name: Update Version + needs: + - check + if: needs.check.outputs.isNew == 'true' + uses: ./.github/workflows/yt-dlp_update.yaml + secrets: inherit + with: + version: ${{ needs.check.outputs.version }} From fbf1bca73e06d04bf58e6bbd0196be3c22f7b149 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:04:39 +0100 Subject: [PATCH 07/11] chore(workflows): Created automated PRs that bump yt-dlp --- .github/workflows/yt-dlp_update.yaml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/yt-dlp_update.yaml diff --git a/.github/workflows/yt-dlp_update.yaml b/.github/workflows/yt-dlp_update.yaml new file mode 100644 index 0000000..977cb65 --- /dev/null +++ b/.github/workflows/yt-dlp_update.yaml @@ -0,0 +1,43 @@ +name: Bump Yt-Dlp +on: + workflow_dispatch: + inputs: + version: + required: true + description: The new yt-dlp version + type: string + workflow_call: + inputs: + version: + required: true + description: The new yt-dlp version + type: string + +env: + YTDLP_VERSION_FILE: .yt-dlprc + +jobs: + update: + name: Update Version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Update .yt-dlprc + run: | + rm $YTDLP_VERSION_FILE + echo "${{ inputs.version }}" >> $YTDLP_VERSION_FILE + cat $YTDLP_VERSION_FILE + - name: Create PR + uses: peter-evans/create-pull-request@v4 + with: + title: "Update yt-dlp to version `${{ inputs.version }}`" + branch: "fix/yt-dlp-version-update" + base: chore/simplify-version-management + add-paths: | + ${{ env.YTDLP_VERSION_FILE }} + commit-message: "fix(yt-dlp): Update yt-dlp to `${{ inputs.version }}`" + delete-branch: true + body: This is an automated Pull Request to update the yt-dlp versions that is used in the docker image. + labels: dependencies + assignees: ${{ github.repository_owner }} + reviewers: ${{ github.repository_owner }} From 174afcf092d58515b46dec84107bef16599d303a Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:05:41 +0100 Subject: [PATCH 08/11] fix(play): Fix typo in args description --- cadency_commands/src/play.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cadency_commands/src/play.rs b/cadency_commands/src/play.rs index 23fc165..3ea8bcc 100644 --- a/cadency_commands/src/play.rs +++ b/cadency_commands/src/play.rs @@ -17,7 +17,7 @@ use songbird::events::Event; #[description = "Play a song from Youtube"] #[deferred = true] #[argument( - name = "quiery", + name = "query", description = "URL or search query like: 'Hey Jude Beatles'", kind = "String" )] From 2983f8c62a04b275e3513ad2d8f84a0b102459d1 Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:34:22 +0100 Subject: [PATCH 09/11] chore(test): Use yt-dlp version defined in repo --- .github/workflows/test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 134b2cf..b262309 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,10 +30,11 @@ jobs: with: prefix-key: "rust-${{ github.job }}" - name: Setup yt-dlp - run: > - wget https://github.com/yt-dlp/yt-dlp/releases/download/2022.09.01/yt-dlp && - chmod a+x yt-dlp && - mv yt-dlp /usr/local/bin && + run: | + VERSION=$(cat .yt-dlprc) + wget https://github.com/yt-dlp/yt-dlp/releases/download/$VERSION/yt-dlp + chmod a+x yt-dlp + mv yt-dlp /usr/local/bin yt-dlp --version - name: Run tests run: cargo test --all From 9a866a6f30610568a3b0db27d6bcb962fb96104e Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 12:43:14 +0100 Subject: [PATCH 10/11] chore(yt-dlp_update): Change PR base branch to main --- .github/workflows/yt-dlp_update.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yt-dlp_update.yaml b/.github/workflows/yt-dlp_update.yaml index 977cb65..e7d19d1 100644 --- a/.github/workflows/yt-dlp_update.yaml +++ b/.github/workflows/yt-dlp_update.yaml @@ -32,7 +32,7 @@ jobs: with: title: "Update yt-dlp to version `${{ inputs.version }}`" branch: "fix/yt-dlp-version-update" - base: chore/simplify-version-management + base: main add-paths: | ${{ env.YTDLP_VERSION_FILE }} commit-message: "fix(yt-dlp): Update yt-dlp to `${{ inputs.version }}`" From 67eb9850018cc66526e250adc8134e42fb32938e Mon Sep 17 00:00:00 2001 From: Jontze <42588836+jontze@users.noreply.github.com> Date: Sat, 25 Feb 2023 13:04:25 +0100 Subject: [PATCH 11/11] chor(version): Bump versions to 0.3.2 --- cadency/Cargo.toml | 6 +++--- cadency_codegen/Cargo.toml | 2 +- cadency_commands/Cargo.toml | 8 ++++---- cadency_core/Cargo.toml | 2 +- cadency_yt_playlist/Cargo.toml | 2 +- examples/custom_commands/Cargo.toml | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cadency/Cargo.toml b/cadency/Cargo.toml index 0a7b312..e7d838e 100644 --- a/cadency/Cargo.toml +++ b/cadency/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadency" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "An extensible discord bot with support with music commands" license = "MIT" @@ -15,8 +15,8 @@ tokio = { workspace = true } [dependencies.cadency_core] path = "../cadency_core" -version = "0.3.1" +version = "0.3.2" [dependencies.cadency_commands] path = "../cadency_commands" -version = "0.3.1" +version = "0.3.2" diff --git a/cadency_codegen/Cargo.toml b/cadency_codegen/Cargo.toml index 8fad4d8..5505a77 100644 --- a/cadency_codegen/Cargo.toml +++ b/cadency_codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadency_codegen" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "Library with codegen macros for the cadency discord bot" license = "MIT" diff --git a/cadency_commands/Cargo.toml b/cadency_commands/Cargo.toml index 317053e..195687b 100644 --- a/cadency_commands/Cargo.toml +++ b/cadency_commands/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadency_commands" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "Library with a collection of some commands for the cadency discord bot" license = "MIT" @@ -18,12 +18,12 @@ serde = { workspace = true } [dependencies.cadency_core] path = "../cadency_core" -version = "0.3.1" +version = "0.3.2" [dependencies.cadency_codegen] path = "../cadency_codegen" -version = "0.3.1" +version = "0.3.2" [dependencies.cadency_yt_playlist] path = "../cadency_yt_playlist" -version = "0.3.1" +version = "0.3.2" diff --git a/cadency_core/Cargo.toml b/cadency_core/Cargo.toml index 02eb581..d157770 100644 --- a/cadency_core/Cargo.toml +++ b/cadency_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadency_core" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "Library with the core logic for the cadency discord bot" license = "MIT" diff --git a/cadency_yt_playlist/Cargo.toml b/cadency_yt_playlist/Cargo.toml index 1bfb390..62106fe 100644 --- a/cadency_yt_playlist/Cargo.toml +++ b/cadency_yt_playlist/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cadency_yt_playlist" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "Library of the cadency discord bot to interact with youtube playlists" license = "MIT" diff --git a/examples/custom_commands/Cargo.toml b/examples/custom_commands/Cargo.toml index ea9ccdd..f4e5cb5 100644 --- a/examples/custom_commands/Cargo.toml +++ b/examples/custom_commands/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "custom_commands" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "An example how to integrate custom commands into cadency_rs" license = "MIT" @@ -19,12 +19,12 @@ log = { workspace = true } [dependencies.cadency_core] path = "../../cadency_core" -version = "0.3.1" +version = "0.3.2" [dependencies.cadency_codegen] path = "../../cadency_codegen" -version = "0.3.1" +version = "0.3.2" [dependencies.cadency_commands] path = "../../cadency_commands" -version = "0.3.1" +version = "0.3.2"