[][src]Struct lavalink_rs::LavalinkClient

pub struct LavalinkClient {
    pub host: String,
    pub port: u16,
    pub password: String,
    pub shard_count: u64,
    pub bot_id: UserId,
    pub is_ssl: bool,
    pub headers: Option<HeaderMap>,
    pub socket_write: Option<SplitSink<WsStream, TungsteniteMessage>>,
    pub rest_uri: String,
    pub socket_uri: String,
    pub nodes: HashMap<u64, Node>,
    pub loops: Vec<u64>,
    // some fields omitted
}

Fields

host: Stringport: u16password: Stringshard_count: u64bot_id: UserIdis_ssl: boolheaders: Option<HeaderMap>socket_write: Option<SplitSink<WsStream, TungsteniteMessage>>rest_uri: Stringsocket_uri: Stringnodes: HashMap<u64, Node>loops: Vec<u64>

Implementations

impl LavalinkClient[src]

pub fn new<U: Into<UserId>>(bot_id: U) -> Self[src]

Builds a basic uninitialized LavalinkClient.

pub fn set_host(&mut self, host: impl ToString)[src]

Sets the host.

DEFAULT: localhost

pub fn set_port(&mut self, port: u16)[src]

Sets the port.

DEFAULT: 2333

pub fn set_shard_count(&mut self, shard_count: u64)[src]

Sets the number of shards.

DEFAULT: 1

pub fn set_bot_id<U: Into<UserId>>(&mut self, bot_id: U)[src]

Sets the ID of the bot.

pub fn set_is_ssl(&mut self, is_ssl: bool)[src]

Sets if the lavalink server is behind SSL

DEFAULT: False

pub fn set_password(&mut self, password: impl ToString)[src]

Sets the lavalink password.

DEFAULT: youshallnotpass

pub async fn initialize(
    __arg0: Self,
    handler: impl LavalinkEventHandler + Send + Sync + 'static
) -> Result<Arc<Mutex<Self>>, TungsteniteError>
[src]

Initializes the connection with the provided information.

pub async fn init(
    self,
    handler: impl LavalinkEventHandler + Send + Sync + 'static
) -> Result<Arc<Mutex<Self>>, TungsteniteError>
[src]

Alias to initialize()

pub async fn get_tracks<'_>(
    &'_ self,
    query: impl ToString
) -> Result<Tracks, ReqwestError>
[src]

Returns the tracks from the URL or query provided.

pub async fn auto_search_tracks<'_>(
    &'_ self,
    query: impl ToString
) -> Result<Tracks, ReqwestError>
[src]

Will automatically search the query if it's not a valid URL.

pub async fn search_tracks<'_>(
    &'_ self,
    query: impl ToString
) -> Result<Tracks, ReqwestError>
[src]

Returns tracks from the search query.

pub async fn create_session<'_, '_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    handler: &'_ Handler
) -> LavalinkResult<()>
[src]

Creates a lavalink session on the specified guild.

pub fn play(guild_id: impl Into<GuildId>, track: Track) -> PlayParameters[src]

Constructor for playing a track.

pub async fn destroy<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> LavalinkResult<()>
[src]

Destroys the current player. When this is ran, create_session() needs to be ran again.

pub async fn stop<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> LavalinkResult<()>
[src]

Stops the current player.

pub async fn skip<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> Option<TrackQueue>
[src]

Skips the current playing track to the next item on the queue.

If nothing is in the queue, the currently playing track will keep playing. Check if the queue is empty and run stop() if that's the case.

pub async fn set_pause<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    pause: bool
) -> LavalinkResult<()>
[src]

Sets the pause status.

pub async fn pause<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> LavalinkResult<()>
[src]

Sets pause status to True

pub async fn resume<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> LavalinkResult<()>
[src]

Sets pause status to False

pub async fn seek<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    time: Duration
) -> LavalinkResult<()>
[src]

Jumps to a specific time in the currently playing track.

pub async fn jump_to_time<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    time: Duration
) -> LavalinkResult<()>
[src]

Alias to seek()

pub async fn scrub<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    time: Duration
) -> LavalinkResult<()>
[src]

Alias to seek()

pub async fn volume<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    volume: u16
) -> LavalinkResult<()>
[src]

Sets the volume of the player.

pub async fn equalize_all<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    bands: [f64; 15]
) -> LavalinkResult<()>
[src]

Sets all equalizer levels.

There are 15 bands (0-14) that can be changed. The floating point value is the multiplier for the given band. The default value is 0. Valid values range from -0.25 to 1.0, where -0.25 means the given band is completely muted, and 0.25 means it is doubled. Modifying the gain could also change the volume of the output.

pub async fn equalize_band<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>,
    band: Band
) -> LavalinkResult<()>
[src]

Equalizes a specific band.

pub async fn equalize_reset<'_>(
    &'_ mut self,
    guild_id: impl Into<GuildId>
) -> LavalinkResult<()>
[src]

Resets all equalizer levels.

Trait Implementations

impl Default for LavalinkClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,