serenity-rs/songbird

YoutubeDL seems to want a reqwest::async_impl__client::Client not a reqwest::Client

Closed this issue · 4 comments

Songbird version: (0.4.3)

Rust version (rustc -V): (version)
rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball)

Serenity/Twilight version: (version)
poise 0.6.1
serenity 0.12.2

Output of ffmpeg -version, yt-dlp --version (if relevant):
not relevant

Description:
YoutubeDL's methods appear to want a reqwest::async_impl_client::Client instead of a reqwest::Client, which is what reqwest 0.12.4 seems to create.

I'm not entirely sure how I even get an async_impl as it is a private module within reqwest

Steps to reproduce:
Easiest way is to clone the repo flashgnash/ordis (tag: songbird-http-client-issue, branch: elevator-music) and build it.

Otherwise, the offending block of code is this (using reqwest 0.12.8)

#[poise::command(slash_command, prefix_command)]
pub async fn play_music(ctx: Context<'_>, url: String) -> Result<(), Error> {
    let do_search = !url.starts_with("http");

    let guild_id = ctx.guild_id().unwrap();

    let http_client = reqwest::Client::new();

    let manager = songbird::get(ctx.serenity_context())
        .await
        .expect("Songbird Voice client placed in at initialisation.")
        .clone();

    if let Some(handler_lock) = manager.get(guild_id) {
        let mut handler = handler_lock.lock().await;

        let mut src = if do_search {
            YoutubeDl::new_search(http_client, url)
        } else {
            YoutubeDl::new(http_client, url)
        };
        let _ = handler.play_input(src.clone().into());

        ctx.reply("Playing song").await?;
    } else {
        return Err(Box::new(VoiceError::UserNotInVoiceChannel));
    }

    Ok(())
}

I've previously been using lazy_static in a shared module to get my HTTP client around, in this case I've just created it in the method for the purpose of debugging

I am quite probably just missing something here, though I believe this is just because of an outdated version of reqwest in songbird?

You need to use 0.11 reqwest to not 0.12. Read your error messages indicating a version mismatch.

Also, please, like already suggested use the discord server for support, you are opening multiple issues that aren't bugs.

You need to use 0.11 reqwest to not 0.12. Read your error messages indicating a version mismatch.

Also, please, like already suggested use the discord server for support, you are opening multiple issues that aren't bugs.

I'm not sure what you mean, this is the first issue I have opened

Incorrectly thought you were someone else, but you talked in a thread that mentioned using the discord server for support.

Incorrectly thought you were someone else, but you talked in a thread that mentioned using the discord server for support.

That was me trying to help the guy, not asking for help

I also believed this was a bug