pub struct Player { /* private fields */ }
Expand description

A player for a guild connected to a node.

This can be used to send events over a node and to read the details of a player for a guild.

Implementations

Send an event to the player’s node.

Returns a futures_channel TrySendError if the node has been removed.

Examples

Send a Play and Pause event:

use twilight_lavalink::{model::{Play, Pause}, Lavalink};

let lavalink = Lavalink::new(user_id, 10);
let players = lavalink.players();

if let Some(player) = players.get(&guild_id) {
    player.send(Play::from((guild_id, track)))?;
    player.send(Pause::from((guild_id, true)))?;
}
Errors

Returns a NodeSenderErrorType::Sending error type if node is no longer connected.

Return an immutable reference to the node linked to the player.

Return the player’s channel ID.

Return the player’s guild ID.

Return whether the player is paused.

Return the player’s position.

Return the player’s time.

Return the player’s volume.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more