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<'py> IntoPyObject<'py> for PlayerContext
impl<'py> IntoPyObject<'py> for PlayerContext
Source§type Target = PlayerContext
type Target = PlayerContext
Source§type Output = Bound<'py, <PlayerContext as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PlayerContext as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§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§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
.Source§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.Source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
.Source§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.Source§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
.impl DerefToPyAny for PlayerContext
Auto Trait Implementations§
impl Freeze for PlayerContext
impl !RefUnwindSafe for PlayerContext
impl Send for PlayerContext
impl Sync for PlayerContext
impl Unpin for PlayerContext
impl !UnwindSafe for PlayerContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.