[][src]Struct discord_game_sdk::Activity

#[repr(transparent)]pub struct Activity(_);

Activity (also known as Rich Presence)

To enable players to join or spectate via invites and requests, some fields are required:

Struct in official docs

discord.update_activity(
    &Activity::empty()
        .with_state("On Main Menu")
        .with_start_time(now),
    |discord, result| {
        if let Err(error) = result {
            eprintln!("failed to update activity: {}", error);
        }
    },
);

Implementations

impl Activity[src]

pub fn empty() -> Self[src]

Create a new Activity with empty fields

pub fn is_empty(&self) -> bool[src]

Check if an Activity is completely blank

pub fn kind(&self) -> ActivityKind[src]

Type of Activty

pub fn application_id(&self) -> ClientID[src]

The unique ID of the application

pub fn name(&self) -> &str[src]

The name of the application

pub fn state(&self) -> &str[src]

The player's current party status

pub fn details(&self) -> &str[src]

What the player is currently doing

pub fn start_time(&self) -> UnixTimestamp[src]

When the current activity has started, in UNIX Time

pub fn end_time(&self) -> UnixTimestamp[src]

When the current activity will end, in UNIX Time

pub fn large_image_key(&self) -> &str[src]

The key of an asset to display

pub fn large_image_tooltip(&self) -> &str[src]

The tooltip displayed when hovering over the large image

pub fn small_image_key(&self) -> &str[src]

The key of an asset to display

pub fn small_image_tooltip(&self) -> &str[src]

The tooltip displayed when hovering over the small image

pub fn party_id(&self) -> &str[src]

The unique identifier for the party

pub fn party_amount(&self) -> u32[src]

The number of players currently in the party

pub fn party_capacity(&self) -> u32[src]

The maximum capacity of the party

pub fn instance(&self) -> bool[src]

Whether this activity is an instanced context, like a match

pub fn match_secret(&self) -> &str[src]

The unique hash for the given match context

pub fn join_secret(&self) -> &str[src]

The unique hash for chat invites and Ask to Join

pub fn spectate_secret(&self) -> &str[src]

The unique hash for Spectate button

pub fn with_state(&mut self, value: &str) -> &mut Self[src]

The player's current party status

Only the first 128 bytes will be written.

pub fn with_details(&mut self, value: &str) -> &mut Self[src]

What the player is currently doing

Only the first 128 bytes will be written.

pub fn with_start_time(&mut self, value: UnixTimestamp) -> &mut Self[src]

When the current activity has started, in UNIX time

pub fn with_end_time(&mut self, value: UnixTimestamp) -> &mut Self[src]

When the current activity will end, in UNIX time

pub fn with_large_image_key(&mut self, value: &str) -> &mut Self[src]

The key of an asset to display

Only the first 128 bytes will be written.

pub fn with_large_image_tooltip(&mut self, value: &str) -> &mut Self[src]

The tooltip displayed when hovering over the large image

Only the first 128 bytes will be written.

pub fn with_small_image_key(&mut self, value: &str) -> &mut Self[src]

The key of an asset to display

Only the first 128 bytes will be written.

pub fn with_small_image_tooltip(&mut self, value: &str) -> &mut Self[src]

The tooltip displayed when hovering over the small image

Only the first 128 bytes will be written.

pub fn with_party_id(&mut self, value: &str) -> &mut Self[src]

The unique identifier for the party

Only the first 128 bytes will be written.

pub fn with_party_amount(&mut self, value: u32) -> &mut Self[src]

The number of players currently in the party

pub fn with_party_capacity(&mut self, value: u32) -> &mut Self[src]

The maximum capacity of the party

pub fn with_instance(&mut self, value: bool) -> &mut Self[src]

Whether this activity is an instanced context, like a match

pub fn with_match_secret(&mut self, value: &str) -> &mut Self[src]

The unique hash for the given match context

Only the first 128 bytes will be written.

pub fn with_join_secret(&mut self, value: &str) -> &mut Self[src]

The unique hash for chat invites and Ask to Join

Only the first 128 bytes will be written.

pub fn with_spectate_secret(&mut self, value: &str) -> &mut Self[src]

The unique hash for Spectate button

Only the first 128 bytes will be written.

Trait Implementations

impl Clone for Activity[src]

impl Debug for Activity[src]

impl Display for Activity[src]

impl Eq for Activity[src]

impl PartialEq<Activity> for Activity[src]

impl StructuralEq for Activity[src]

impl StructuralPartialEq for Activity[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.