pub struct PlayerContext {
pub guild_id: GuildId,
pub client: LavalinkClient,
/* private fields */
}
Expand description
The player context.
Fields§
§guild_id: GuildId
§client: LavalinkClient
Implementations§
Source§impl PlayerContext
impl PlayerContext
Sourcepub fn close(self) -> LavalinkResult<()>
pub fn close(self) -> LavalinkResult<()>
Close the current player.
Sourcepub fn skip(&self) -> LavalinkResult<()>
pub fn skip(&self) -> LavalinkResult<()>
Skip the current track and play the next in the queue.
Sourcepub fn finish(&self, should_continue: bool) -> LavalinkResult<()>
pub fn finish(&self, should_continue: bool) -> LavalinkResult<()>
Sourcepub fn update_player_data(&self, player: Player) -> LavalinkResult<()>
pub fn update_player_data(&self, player: Player) -> LavalinkResult<()>
Update player data in the context.
Sourcepub fn queue(&self, track: impl Into<TrackInQueue>) -> LavalinkResult<()>
pub fn queue(&self, track: impl Into<TrackInQueue>) -> LavalinkResult<()>
Add a track to the end of the queue.
Sourcepub async fn get_player(&self) -> LavalinkResult<Player>
pub async fn get_player(&self) -> LavalinkResult<Player>
Get the current player information.
Sourcepub async fn update_player(
&self,
update_player: &UpdatePlayer,
no_replace: bool,
) -> LavalinkResult<Player>
pub async fn update_player( &self, update_player: &UpdatePlayer, no_replace: bool, ) -> LavalinkResult<Player>
Request a raw player update.
Sourcepub async fn play(&self, track: &TrackData) -> LavalinkResult<Player>
pub async fn play(&self, track: &TrackData) -> LavalinkResult<Player>
Try and play a track. Does not change tracks if one is already playing.
NOTE: Does not modify the queue.
Sourcepub async fn play_now(&self, track: &TrackData) -> LavalinkResult<Player>
pub async fn play_now(&self, track: &TrackData) -> LavalinkResult<Player>
Force play a track, replacing the current track.
NOTE: Does not modify the queue.
Sourcepub async fn stop_now(&self) -> LavalinkResult<Player>
pub async fn stop_now(&self) -> LavalinkResult<Player>
Stop playing the current track.
This does not continue playback of the queue.
Sourcepub async fn set_pause(&self, pause: bool) -> LavalinkResult<Player>
pub async fn set_pause(&self, pause: bool) -> LavalinkResult<Player>
Set the pause state of the player.
Sourcepub async fn set_volume(&self, volume: u16) -> LavalinkResult<Player>
pub async fn set_volume(&self, volume: u16) -> LavalinkResult<Player>
Set the volume of the player.
Sourcepub async fn set_filters(&self, filters: Filters) -> LavalinkResult<Player>
pub async fn set_filters(&self, filters: Filters) -> LavalinkResult<Player>
Set the filters of the player.
Sourcepub async fn set_position(&self, position: Duration) -> LavalinkResult<Player>
pub async fn set_position(&self, position: Duration) -> LavalinkResult<Player>
Jump to a specific position in the currently playing track.
Sourcepub fn data<Data: Send + Sync + 'static>(&self) -> LavalinkResult<Arc<Data>>
pub fn data<Data: Send + Sync + 'static>(&self) -> LavalinkResult<Arc<Data>>
Get the custom data provided when creating the player context.
§Errors
Returns LavalinkError::InvalidDataType
if the type argument provided does not match the type of the data provided,
or if no data was provided when creating the player context.
Trait Implementations§
Source§impl Clone for PlayerContext
impl Clone for PlayerContext
Source§fn clone(&self) -> PlayerContext
fn clone(&self) -> PlayerContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl PyClass for PlayerContext
impl PyClass for PlayerContext
Source§impl PyClassImpl for PlayerContext
impl PyClassImpl for PlayerContext
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<PlayerContext>
type ThreadChecker = SendablePyClass<PlayerContext>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PlayerContext
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PlayerContext
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PlayerContext
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PlayerContext
Source§impl PyMethods<PlayerContext> for PyClassImplCollector<PlayerContext>
impl PyMethods<PlayerContext> for PyClassImplCollector<PlayerContext>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for PlayerContext
impl PyTypeInfo for PlayerContext
Source§type AsRefTarget = PyCell<PlayerContext>
type AsRefTarget = PyCell<PlayerContext>
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.Source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.