DisTube API Documentation
    Preparing search index...

    Class DisTube

    DisTube class

    Hierarchy

    Index

    Constructors

    Properties

    client: Client

    Discord.js v14 client

    filters: Filters

    DisTube ffmpeg audio filters

    DisTube internal handler

    options: Options

    DisTube options

    plugins: DisTubePlugin[]

    DisTube plugins

    queues: QueueManager

    Queues manager

    DisTube voice connections manager

    defaultMaxListeners: number

    Accessors

    Methods

    • Add related song to the queue

      Parameters

      Returns Promise<Song<unknown>>

      The guild queue

      Use distube.getQueue(guild).addRelatedSong() instead. Will be removed in v6.0.

    • Emit debug event

      Parameters

      • message: string

        debug message

      Returns void

    • Emit error event

      Parameters

      • error: Error

        error

      • queue: Queue

        The queue encountered the error

      • Optionalsong: Song<unknown>

        The playing song when encountered the error

      Returns void

    • Type Parameters

      Returns U[]

    • Returns number

    • Jump to the song number in the queue. The next one is 1, 2,... The previous one is -1, -2,...

      Parameters

      Returns Promise<Song<unknown>>

      The new Song will be played

      Use distube.getQueue(guild).jump(num, options) instead. Will be removed in v6.0.

    • Parameters

      Returns number

    • Play / add a song or playlist from url. Search and play a song (with ExtractorPlugin) if it is not a valid url.

      Type Parameters

      • T = unknown

      Parameters

      • voiceChannel: VoiceBasedChannel

        The channel will be joined if the bot isn't in any channels, the bot will be moved to this channel if DisTubeOptions.joinNewVoiceChannel is true

      • song: string | Song<unknown> | Playlist<unknown>

        URL | Search string | Song | Playlist

      • options: PlayOptions<T> = {}

        Optional options

      Returns Promise<void>

    • Play the previous song

      Parameters

      Returns Promise<Song<unknown>>

      The new Song will be played

      Use distube.getQueue(guild).previous() instead. Will be removed in v6.0.

    • Parameters

      • Optionalevent: keyof DisTubeEvents

      Returns this

    • Set the playing time to another position

      Parameters

      Returns Promise<Queue>

      Seeked queue

      Use distube.getQueue(guild).seek(time) instead. Will be removed in v6.0.

    • Parameters

      • n: number

      Returns this

    • Set the repeat mode of the guild queue. Toggle mode (Disabled -> Song -> Queue -> Disabled ->...) if mode is undefined

      Parameters

      Returns RepeatMode

      The new repeat mode

      Use distube.getQueue(guild).setRepeatMode(mode) instead. Will be removed in v6.0.

    • Set the guild stream's volume

      Parameters

      • guild: GuildIdResolvable

        The type can be resolved to give a Queue

      • percent: number

        The percentage of volume you want to set

      Returns Queue

      The guild queue

      Use distube.getQueue(guild).setVolume(percent) instead. Will be removed in v6.0.

    • Skip the playing song if there is a next song in the queue. If Queue#autoplay is true and there is no up next song, DisTube will add and play a related song.

      Parameters

      Returns Promise<Song<unknown>>

      The new Song will be played

      Use distube.getQueue(guild).skip(options) instead. Will be removed in v6.0.

    • Toggle autoplay mode

      Parameters

      Returns boolean

      Autoplay mode state

      Use distube.getQueue(guild).toggleAutoplay() instead. Will be removed in v6.0.

    Events

    addList: (queue: Queue, playlist: Playlist) => any

    Emitted after DisTube add a new playlist to the playing Queue.

    Type Declaration

    addSong: (queue: Queue, song: Song) => any

    Emitted after DisTube add a new song to the playing Queue.

    Type Declaration

      • (queue: Queue, song: Song): any
      • Parameters

        • queue: Queue

          The guild queue

        • song: Song

          Added song

        Returns any

    debug: (debug: string) => any

    Emitted to provide debug information from DisTube's operation. Useful for troubleshooting or logging purposes.

    Type Declaration

      • (debug: string): any
      • Parameters

        • debug: string

          Debug message string.

        Returns any

    deleteQueue: (queue: Queue) => any

    Emitted when a Queue is deleted with any reasons.

    Type Declaration

      • (queue: Queue): any
      • Parameters

        • queue: Queue

          The guild queue

        Returns any

    disconnect: (queue: Queue) => any

    Emitted when the bot is disconnected to a voice channel.

    Type Declaration

      • (queue: Queue): any
      • Parameters

        • queue: Queue

          The guild queue

        Returns any

    error: (error: Error, queue: Queue, song?: Song<unknown>) => any

    Emitted when DisTube encounters an error while playing songs.

    Type Declaration

      • (error: Error, queue: Queue, song?: Song<unknown>): any
      • Parameters

        • error: Error

          error

        • queue: Queue

          The queue encountered the error

        • Optionalsong: Song<unknown>

          The playing song when encountered the error

        Returns any

    ffmpegDebug: (debug: string) => any

    Emitted for logging FFmpeg debug information.

    Type Declaration

      • (debug: string): any
      • Parameters

        • debug: string

          Debug message string.

        Returns any

    finish: (queue: Queue) => any

    Emitted when there is no more song in the queue and Queue#autoplay is false.

    Type Declaration

      • (queue: Queue): any
      • Parameters

        • queue: Queue

          The guild queue

        Returns any

    finishSong: (queue: Queue, song: Song) => any

    Emitted when DisTube finished a song.

    Type Declaration

      • (queue: Queue, song: Song): any
      • Parameters

        • queue: Queue

          The guild queue

        • song: Song

          Finished song

        Returns any

    initQueue: (queue: Queue) => any

    Emitted when DisTube initialize a queue to change queue default properties.

    Type Declaration

      • (queue: Queue): any
      • Parameters

        • queue: Queue

          The guild queue

        Returns any

    noRelated: (queue: Queue) => any

    Emitted when Queue#autoplay is true, Queue#songs is empty, and DisTube cannot find related songs to play.

    Type Declaration

      • (queue: Queue): any
      • Parameters

        • queue: Queue

          The guild queue

        Returns any

    playSong: (queue: Queue, song: Song) => any

    Emitted when DisTube play a song. If DisTubeOptions.emitNewSongOnly is true, this event is not emitted when looping a song or next song is the previous one.

    Type Declaration

      • (queue: Queue, song: Song): any
      • Parameters

        • queue: Queue

          The guild queue

        • song: Song

          Playing song

        Returns any