Skip to content

Playing a user's track from a file? #317

Closed

Description

@shizamuru-dev

Hi, I was wondering if there is any way to play the sound from a file attached by the user?

I don't see in the documentation mentioning any local source (for uploading a file to the server, and further playback), or the possibility to add a raw track (via discord.File.fb).

Activity

  1. EvieePy commented on Aug 20, 2024

    @EvieePy
    Member

    Hey if you have an attachment and the attachment still exists in the channel (E.g the message has not been deleted) you can use the url of the attachment to search tracks directly.

    tracks: wavelink.Search = await wavelink.Playable.search(attachment.url)
    
    # Rest of code...

    If you have files on your server that you want to play you can pass, None to source= in the Playable.search()

    tracks: wavelink.Search = await wavelink.Playable.search("local.mp3", source=None)
    
    # Rest of code...
  2. locked and limited conversation to collaborators on Aug 20, 2024
  3. converted this issue into a discussion #318 on Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions