Struct serenity::model::gateway::Activity [−][src]
#[non_exhaustive]pub struct Activity {}Show fields
pub application_id: Option<ApplicationId>, pub assets: Option<ActivityAssets>, pub details: Option<String>, pub flags: Option<ActivityFlags>, pub instance: Option<bool>, pub kind: ActivityType, pub name: String, pub party: Option<ActivityParty>, pub secrets: Option<ActivitySecrets>, pub state: Option<String>, pub emoji: Option<ActivityEmoji>, pub timestamps: Option<ActivityTimestamps>, pub sync_id: Option<String>, pub session_id: Option<String>, pub url: Option<String>, pub buttons: Vec<ActivityButton>,
Expand description
Representation of an activity that a User
is performing.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.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.
emoji: Option<ActivityEmoji>
Emoji currently used in custom status
timestamps: Option<ActivityTimestamps>
Unix timestamps for the start and/or end times of the activity.
sync_id: Option<String>
unstable_discord_api
only.The sync ID of the activity. Mainly used by the Spotify activity type which uses this parameter to store the track ID.
session_id: Option<String>
unstable_discord_api
only.The session ID of the activity. Reserved for specific activity types, such as the Activity that is transmitted when a user is listening to Spotify.
url: Option<String>
The Stream URL if Self::kind
is ActivityType::Streaming
.
The buttons of this activity.
Note: There can only be up to 2 buttons.
Implementations
Creates a Activity
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] async fn activity(ctx: &Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::playing(&name)).await; Ok(()) }
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] async fn stream(ctx: &Context, _msg: &Message, args: Args) -> CommandResult { const STREAM_URL: &str = "..."; let name = args.message(); ctx.set_activity(Activity::streaming(&name, STREAM_URL)).await; Ok(()) }
Creates a Activity
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] async fn listen(ctx: &Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::listening(&name)).await; Ok(()) }
Creates a Activity
struct that appears as a Watching <name>
status.
Note: Maximum name
length is 128.
Examples
Create a command that sets the current cometing status:
use serenity::model::gateway::Activity; use serenity::model::channel::Message; use serenity::framework::standard::{Args, CommandResult, macros::command}; use serenity::client::Context; #[command] async fn watch(ctx: &Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::watching(&name)).await; Ok(()) }
Creates a Activity
struct that appears as a Competing in <name>
status.
Note: Maximum name
length is 128.
Examples
Create a command that sets the current cometing status:
use serenity::model::gateway::Activity; use serenity::model::channel::Message; use serenity::framework::standard::{Args, CommandResult, macros::command}; use serenity::client::Context; #[command] async fn compete(ctx: &Context, _msg: &Message, args: Args) -> CommandResult { let name = args.message(); ctx.set_activity(Activity::competing(&name)).await; Ok(()) }
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Activity
impl UnwindSafe for Activity
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V