[−][src]Struct serenity::model::gateway::Activity
Representation of an activity that a User
is performing.
Fields
application_id: Option<ApplicationId>
The ID of the application for the activity.
assets: Option<ActivityAssets>
Images for the presence and their texts.
details: Option<String>
What the user is doing.
flags: Option<ActivityFlags>
Activity flags describing what the payload includes.
instance: Option<bool>
Whether or not the activity is an instanced game session.
kind: ActivityType
The type of activity being performed
name: String
The name of the activity.
party: Option<ActivityParty>
Information about the user's current party.
secrets: Option<ActivitySecrets>
Secrets for Rich Presence joining and spectating.
state: Option<String>
The user's current party status.
timestamps: Option<ActivityTimestamps>
Unix timestamps for the start and/or end times of the activity.
url: Option<String>
The Stream URL if kind
is ActivityType::Streaming
.
Methods
impl Activity
[src]
pub fn playing(name: &str) -> Activity
[src]
Creates a Game
struct that appears as a Playing <name>
status.
Note: Maximum name
length is 128.
Examples
Create a command that sets the current activity:
use serenity::model::gateway::Activity; use serenity::model::channel::Message; use serenity::framework::standard::{Args, CommandResult, macros::command}; use serenity::client::Context; #[command] fn activity(ctx: &mut Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::playing(&name)); Ok(()) }
pub fn streaming(name: &str, url: &str) -> Activity
[src]
Creates an Activity
struct that appears as a Streaming <name>
status.
Note: Maximum name
length is 128.
Examples
Create a command that sets the current streaming status:
use serenity::model::gateway::Activity; use serenity::model::channel::Message; use serenity::framework::standard::{Args, CommandResult, macros::command}; use serenity::client::Context; #[command] fn stream(ctx: &mut Context, _msg: &Message, args: Args) -> CommandResult { const STREAM_URL: &str = "..."; let name = args.message(); ctx.set_activity(Activity::streaming(&name, STREAM_URL)); Ok(()) }
pub fn listening(name: &str) -> Activity
[src]
Creates a Game
struct that appears as a Listening to <name>
status.
Note: Maximum name
length is 128.
Examples
Create a command that sets the current listening status:
use serenity::model::gateway::Activity; use serenity::model::channel::Message; use serenity::framework::standard::{Args, CommandResult, macros::command}; use serenity::client::Context; #[command] fn listen(ctx: &mut Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::listening(&name)); Ok(()) }
Trait Implementations
impl Clone for Activity
[src]
impl Debug for Activity
[src]
impl<'de> Deserialize<'de> for Activity
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> StdResult<Self, D::Error>
[src]
deserializer: D
) -> StdResult<Self, D::Error>
impl Serialize for Activity
[src]
Auto Trait Implementations
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnwindSafe for Activity
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
[src]
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
[src]
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
[src]
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Send + Sync> where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
T: Any + Debug,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,