Skip to content

Commit

Permalink
Add ActivityData::custom method
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Aug 9, 2023
1 parent fa75456 commit e1a0234
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ impl ActivityData {
url: None,
}
}

/// Creates an activity that appears as `<state>`.
#[must_use]
pub fn custom(state: impl Into<String>) -> Self {
Self {
// discord seems to require a name for custom activities
// even though it's not displayed
name: "~".to_string(),
kind: ActivityType::Custom,
state: Some(state.into()),
url: None,
}
}
}

impl From<Activity> for ActivityData {
Expand Down

0 comments on commit e1a0234

Please sign in to comment.