Skip to content

Commit

Permalink
add discord status buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Jul 24, 2024
1 parent 8edc2c5 commit 0b58cda
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src-tauri/src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub fn initialize_drpc() {
}
let nick_name_detail = format!("Playing as {}", name);
let full_server_address = format!("{}:{}", ip, port);
let play_together_link =
format!("omp-launcher://{}", full_server_address.to_string());
hostname = if !hostname.is_empty() {
hostname
} else {
Expand All @@ -162,7 +164,11 @@ pub fn initialize_drpc() {
.small_image(small_logo.as_str())
.small_text(players.as_str()),
)
.timestamps(timestamp.clone().start(start_time.try_into().unwrap()));
.timestamps(timestamp.clone().start(start_time.try_into().unwrap()))
.buttons(vec![
activity::Button::new("🎮 Player Together", play_together_link.as_str()),
activity::Button::new("📥 Download Launcher", "https://www.open.mp/"),
]);

match client.set_activity(activity) {
Ok(_) => {}
Expand Down Expand Up @@ -192,7 +198,11 @@ pub fn initialize_drpc() {
.large_image("logo")
.large_text("Idle"),
)
.timestamps(timestamp.clone().start(start_time.try_into().unwrap()));
.timestamps(timestamp.clone().start(start_time.try_into().unwrap()))
.buttons(vec![activity::Button::new(
"📥 Download Launcher",
"https://www.open.mp/",
)]);

match client.set_activity(activity) {
Ok(_) => {}
Expand Down

0 comments on commit 0b58cda

Please sign in to comment.