diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 093ccda..15e467e 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -18,15 +18,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker buildx id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub's container registry if: github.event_name != 'pull_request' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} diff --git a/.github/workflows/cargo-clippy.yml b/.github/workflows/cargo-clippy.yml index b053994..0a6bf61 100644 --- a/.github/workflows/cargo-clippy.yml +++ b/.github/workflows/cargo-clippy.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Rust uses: actions-rs/toolchain@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1937c8c..e06cb0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,12 @@ ## 2.2.1 | TBD +- Added new option: `/playing` can now receive an updating behavior parameter - Fixed a bug where uncached guilds would panic the bot - Fixed small issue with embed styling +- Updated to Rust 1.80.1 (from 1.79.0) +- Removed `lazy_static` in favor of `LazyLock` (Rust 1.80.0+ feature) +- Updated `diesel` and addons to latest versions ## 2.2.0 | August 13th 2024 diff --git a/Cargo.lock b/Cargo.lock index 6c808fe..3576eff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -592,14 +592,12 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "deadpool" -version = "0.9.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e" +checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ - "async-trait", "deadpool-runtime", "num_cpus", - "retain_mut", "tokio", ] @@ -681,22 +679,23 @@ dependencies = [ [[package]] name = "diesel" -version = "2.1.6" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" +checksum = "bf97ee7261bb708fa3402fa9c17a54b70e90e3cb98afb3dc8999d5512cb03f94" dependencies = [ "bitflags 2.6.0", "byteorder", "chrono", "diesel_derives", "itoa", + "pq-sys", ] [[package]] name = "diesel-async" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acada1517534c92d3f382217b485db8a8638f111b0e3f2a2a8e26165050f77be" +checksum = "fcb799bb6f8ca6a794462125d7b8983b0c86e6c93a33a9c55934a4a5de4409d3" dependencies = [ "async-trait", "deadpool", @@ -709,9 +708,9 @@ dependencies = [ [[package]] name = "diesel_async_migrations" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a700d6b83a17973b94d3065970fd2b36f1036c3fe08adcbdce1c9beb8fb25553" +checksum = "377dd8e9d0fdab3dbb66236f8f71206b98e121991449f3b363a19d7948333160" dependencies = [ "diesel", "diesel-async", @@ -732,11 +731,12 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.1.4" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14701062d6bed917b5c7103bdffaee1e4609279e240488ad24e7bd979ca6866c" +checksum = "d6ff2be1e7312c858b2ef974f5c7089833ae57b5311b334b30923af58e5718d8" dependencies = [ "diesel_table_macro_syntax", + "dsl_auto_type", "proc-macro2", "quote", "syn 2.0.72", @@ -744,9 +744,9 @@ dependencies = [ [[package]] name = "diesel_table_macro_syntax" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" +checksum = "209c735641a413bc68c4923a9d6ad4bcb3ca306b794edaa7eb0b3228a99ffb25" dependencies = [ "syn 2.0.72", ] @@ -779,6 +779,20 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dsl_auto_type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" +dependencies = [ + "darling 0.20.10", + "either", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "either" version = "1.13.0" @@ -2515,6 +2529,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "pq-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a24ff9e4cf6945c988f0db7005d87747bf72864965c3529d259ad155ac41d584" +dependencies = [ + "vcpkg", +] + [[package]] name = "primal-check" version = "0.3.4" @@ -2904,12 +2927,6 @@ dependencies = [ "winreg 0.52.0", ] -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[package]] name = "ring" version = "0.16.20" @@ -3753,7 +3770,6 @@ dependencies = [ name = "spoticord_config" version = "2.2.0" dependencies = [ - "lazy_static", "rspotify", "serenity", ] @@ -4217,9 +4233,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", @@ -4792,6 +4808,12 @@ dependencies = [ "ryu", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "vergen" version = "8.3.2" diff --git a/Cargo.toml b/Cargo.toml index deee9a0..1ce2152 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ log = "0.4.22" poise = "0.6.1" serenity = "0.12.2" songbird = { version = "0.4.3", features = ["simd-json"] } -tokio = { version = "1.39.2", features = ["full"] } +tokio = { version = "1.39.3", features = ["full"] } [profile.release] opt-level = 3 diff --git a/Dockerfile b/Dockerfile index 4346d68..24df520 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Builder -FROM --platform=linux/amd64 rust:1.79.0-buster AS builder +FROM --platform=linux/amd64 rust:1.80.1-slim AS builder WORKDIR /app diff --git a/spoticord_audio/Cargo.toml b/spoticord_audio/Cargo.toml index 8f27a75..b787a4e 100644 --- a/spoticord_audio/Cargo.toml +++ b/spoticord_audio/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" [dependencies] librespot = { git = "https://github.com/SpoticordMusic/librespot.git", version = "0.5.0-dev", default-features = false } songbird = { version = "0.4.3", features = ["simd-json"] } -tokio = { version = "1.39.2", features = ["sync"], default-features = false } +tokio = { version = "1.39.3", features = ["sync"], default-features = false } zerocopy = "0.7.35" diff --git a/spoticord_config/Cargo.toml b/spoticord_config/Cargo.toml index 86879c1..ef8a227 100644 --- a/spoticord_config/Cargo.toml +++ b/spoticord_config/Cargo.toml @@ -4,7 +4,6 @@ version = "2.2.0" edition = "2021" [dependencies] -lazy_static = "1.5.0" rspotify = { version = "0.13.2", default-features = false, features = [ "client-reqwest", "reqwest-rustls-tls", diff --git a/spoticord_config/src/env.rs b/spoticord_config/src/env.rs index 4aecea4..651bde9 100644 --- a/spoticord_config/src/env.rs +++ b/spoticord_config/src/env.rs @@ -1,14 +1,17 @@ -use lazy_static::lazy_static; +use std::sync::LazyLock; -lazy_static! { - pub static ref DISCORD_TOKEN: String = - std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN environment variable"); - pub static ref DATABASE_URL: String = - std::env::var("DATABASE_URL").expect("missing DATABASE_URL environment variable"); - pub static ref LINK_URL: String = - std::env::var("LINK_URL").expect("missing LINK_URL environment variable"); - pub static ref SPOTIFY_CLIENT_ID: String = - std::env::var("SPOTIFY_CLIENT_ID").expect("missing SPOTIFY_CLIENT_ID environment variable"); - pub static ref SPOTIFY_CLIENT_SECRET: String = std::env::var("SPOTIFY_CLIENT_SECRET") - .expect("missing SPOTIFY_CLIENT_SECRET environment variable"); -} +pub static DISCORD_TOKEN: LazyLock = LazyLock::new(|| { + std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN environment variable") +}); +pub static DATABASE_URL: LazyLock = LazyLock::new(|| { + std::env::var("DATABASE_URL").expect("missing DATABASE_URL environment variable") +}); +pub static LINK_URL: LazyLock = + LazyLock::new(|| std::env::var("LINK_URL").expect("missing LINK_URL environment variable")); +pub static SPOTIFY_CLIENT_ID: LazyLock = LazyLock::new(|| { + std::env::var("SPOTIFY_CLIENT_ID").expect("missing SPOTIFY_CLIENT_ID environment variable") +}); +pub static SPOTIFY_CLIENT_SECRET: LazyLock = LazyLock::new(|| { + std::env::var("SPOTIFY_CLIENT_SECRET") + .expect("missing SPOTIFY_CLIENT_SECRET environment variable") +}); diff --git a/spoticord_database/Cargo.toml b/spoticord_database/Cargo.toml index eeee740..a0fe30a 100644 --- a/spoticord_database/Cargo.toml +++ b/spoticord_database/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" [dependencies] spoticord_config = { path = "../spoticord_config" } -diesel = { version = "2.1.6", features = ["chrono"] } -diesel-async = { version = "0.4.1", features = ["deadpool", "postgres"] } +diesel = { version = "2.2.2", features = ["chrono"] } +diesel-async = { version = "0.5.0", features = ["deadpool", "postgres"] } rspotify = { version = "0.13.2", default-features = false, features = [ "client-reqwest", "reqwest-rustls-tls", @@ -15,4 +15,4 @@ rspotify = { version = "0.13.2", default-features = false, features = [ chrono = "0.4.38" thiserror = "1.0.63" rand = "0.8.5" -diesel_async_migrations = "0.12.0" +diesel_async_migrations = "0.13.0" diff --git a/spoticord_player/Cargo.toml b/spoticord_player/Cargo.toml index 624e910..b567baa 100644 --- a/spoticord_player/Cargo.toml +++ b/spoticord_player/Cargo.toml @@ -11,7 +11,7 @@ spoticord_utils = { path = "../spoticord_utils" } librespot = { git = "https://github.com/SpoticordMusic/librespot.git", version = "0.5.0-dev", default-features = false } songbird = { version = "0.4.3", features = ["simd-json"] } -tokio = { version = "1.39.2", features = ["full"] } +tokio = { version = "1.39.3", features = ["full"] } anyhow = "1.0.86" log = "0.4.22" symphonia = { version = "0.5.4", default-features = false, features = ["pcm"] } diff --git a/spoticord_session/Cargo.toml b/spoticord_session/Cargo.toml index e13754b..6b66a5f 100644 --- a/spoticord_session/Cargo.toml +++ b/spoticord_session/Cargo.toml @@ -11,7 +11,7 @@ spoticord_database = { path = "../spoticord_database" } spoticord_player = { path = "../spoticord_player" } spoticord_utils = { path = "../spoticord_utils" } -tokio = { version = "1.39.2", features = ["full"] } +tokio = { version = "1.39.3", features = ["full"] } librespot = { git = "https://github.com/SpoticordMusic/librespot.git", version = "0.5.0-dev", default-features = false } serenity = "0.12.2" songbird = { version = "0.4.3", features = ["simd-json"] } diff --git a/spoticord_session/src/playback_embed.rs b/spoticord_session/src/playback_embed.rs index 2070d03..1c38482 100644 --- a/spoticord_session/src/playback_embed.rs +++ b/spoticord_session/src/playback_embed.rs @@ -25,8 +25,13 @@ pub enum Command { #[derive(Debug, Default, ChoiceParameter)] pub enum UpdateBehavior { #[default] + #[name = "Automatically update the embed"] Default, + + #[name = "Do not update the embed"] Static, + + #[name = "Re-send the embed after track changes"] Pinned, }