Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • EventEmitter
    • Player

Index

Constructors

constructor

  • example
    const { Player } = require('discord-music-player');
    const discord = require('discord.js')
    const client = new discord.Client();
    const player = new Player(client, {  autoSelfDeaf: false });
    

    Parameters

    • client: Client

      discord client

    • Optional options: options

    Returns Player

Properties

options

options: Null<options> = null

playerClient

playerClient: Client

client

playerQueue

playerQueue: Map<string, Queue>

queue

Static defaultMaxListeners

defaultMaxListeners: number

Methods

Protected _createQueue

  • _createQueue(message: Message, track: Track): boolean | void
  • Parameters

    • message: Message

      discord message event

    • track: Track

      a url

    Returns boolean | void

Protected _playTrack

  • _playTrack(queue: Queue): boolean | void

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

clear

  • clear(message: Message): boolean | void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getQueue

  • getQueue(message: Message): boolean | Queue
  • example
    const queue = player.getQueue('guildid');
    

    Parameters

    • message: Message

    Returns boolean | Queue

    queue for provided guild id

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

nowPlaying

  • nowPlaying(message: Message): boolean | Track

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

on

  • on(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

once

  • once(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

pause

  • pause(message: Message): boolean

play

  • play(msg: Message, argument: string): Promise<boolean | void>
  • example
    client.on('mesage', message => {
    let argumnet = message.content.slice('play'.length);
    player.play(message, argument)
    })
    

    Parameters

    • msg: Message

      messge event

    • argument: string

      string

    Returns Promise<boolean | void>

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

remove

  • remove(message: Message, postion: number): boolean | void
  • remove a track from the queue

    Parameters

    • message: Message
    • postion: number

      index of the song to removed

    Returns boolean | void

removeAllListeners

  • removeAllListeners(event?: string | symbol): Player
  • Parameters

    • Optional event: string | symbol

    Returns Player

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

resume

  • resume(message: Message): boolean

setFilter

  • setFilter(msg: Message, data: filters): any

setLoopMode

  • setLoopMode(message: Message): boolean
  • enables loop mode

    Parameters

    • message: Message

    Returns boolean

    true if loop is enabled else false

setMaxListeners

  • setMaxListeners(n: number): Player
  • Parameters

    • n: number

    Returns Player

setVolume

  • setVolume(message: Message, volume: number): number | boolean
  • sets volume 0-100

    Parameters

    • message: Message
    • volume: number

      number to which volume to be changed

    Returns number | boolean

    previous volume

skip

  • skip(message: Message): undefined | boolean

stop

  • stop(message: Message): boolean
  • stops the track and bot leaves voice channel

    Parameters

    • message: Message

    Returns boolean

    true

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc