ManagerPlayerOptions

Type: object

Parameter
Type
Required
Description

applyVolumeAsFilter

X

If set to true, it will use the Lavalink's filter.volume instead of lavalink.volume.

clientBasedPositionUpdateInterval

X

How frequently to update the player.position on the client side for more accurate position display, without requiring "more" cpu usage

defaultSearchPlatform

X

which SearchPlatform to use, when no Platform was provided doring player.search

volumeDecrementer

X

Decrement the Volume on the Lavalink server by a x % (decimal. aka decrement 70% => 0.7)

requesterTransformer

X

Transform the Requester User Object, to something you want, to reduce track-object-size aka save memory

onDisconnect

{

}

X

What the Manager should do when the Bot get's disconnected

onDisconnect.autoReconnect

X

Should the Manager try to reconnect the Bot?

onDisconnect.destroyPlayer

X

Or should the Manager directly Destroy the Player (overrides autoReconnect)

onEmptyQueue

{

autoPlayFunction?: () =>

}

X

What the Manager should do when the Queue get's empty

onEmptyQueue.destroyAfterMs

X

== 0 => Destroy Player immediately > 0 => Destroy Player after that amount (in Milliseconds) < 0 || NaN || undefined => Don't destroy the Player

onEmptyQueue.autoPlayFunction

X

useUnresolvedData

X

If true, and you provide an unresolvedTrack, when resolving the Track, it overrides the real data with the provided data (to fake/enforce sources / titles, whatever)

Example

{
    applyVolumeAsFilter: false,
    clientBasedPositionUpdateInterval: 50,
    defaultSearchPlatform: "ytmsearch",
    volumeDecrementer: 0.75, // on client 100% == on lavalink 75%
    requesterTransformer: requesterTransformer,
    onDisconnect: {
        autoReconnect: true, // automatically attempts a reconnect, if the bot disconnects from the voice channel, if it fails, it get's destroyed
        destroyPlayer: false // overrides autoReconnect and directly destroys the player if the bot disconnects from the vc
    },
    onEmptyQueue: {
        destroyAfterMs: 30_000, // 0 === instantly destroy | don't provide the option, to don't destroy the player
        autoPlayFunction: autoPlayFunction,
    },
    useUnresolvedData: true
}

Interface

export interface ManagerPlayerOptions {
  /** If the Lavalink Volume should be decremented by x number */
  volumeDecrementer?: number;
  /** How often it should update the the player Position */
  clientBasedPositionUpdateInterval?: number;
  /** What should be used as a searchPlatform, if no source was provided during the query */
  defaultSearchPlatform?: SearchPlatform;
  /** Applies the volume via a filter, not via the lavalink volume transformer */
  applyVolumeAsFilter?:boolean;
  /** Transforms the saved data of a requested user */
  requesterTransformer?: (requester:unknown) => unknown;
  /** What lavalink-client should do when the player reconnects */
  onDisconnect?: {
    /** Try to reconnect? -> If fails -> Destroy */
    autoReconnect?: boolean;
    /** Instantly destroy player (overrides autoReconnect) */
    destroyPlayer?: boolean;
  };
  /* What the Player should do, when the queue gets empty */
  onEmptyQueue?: {
    /** Get's executed onEmptyQueue -> You can do any track queue previous transformations, if you add a track to the queue -> it will play it, if not queueEnd will execute! */
    autoPlayFunction?: (player:Player, lastPlayedTrack:Track) => Promise<void>;
    /* aut. destroy the player after x ms, if 0 it instantly destroys, don't provide to not destroy the player */
    destroyAfterMs?: number;
  };
  /* If to override the data from the Unresolved Track. for unresolved tracks */
  useUnresolvedData?: boolean;
}

Last updated