From 1ac4198ec988ac49cb7740336df7a43bab3fbe52 Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Sat, 3 Aug 2024 00:13:03 +0200 Subject: feat: Pick random adjective when generating release notes (#995) from a list of predefined ones --- src-tauri/Cargo.lock | 1 + src-tauri/Cargo.toml | 2 ++ src-tauri/src/github/release_notes.rs | 45 ++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 376e948e..1e7eacbc 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1179,6 +1179,7 @@ dependencies = [ "octocrab", "open 5.3.0", "pretty_env_logger", + "rand 0.8.5", "regex", "remove-markdown-links", "reqwest 0.11.27", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4d28ca2e..210c76b8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -65,6 +65,8 @@ semver = "1.0" # simplified filesystem access glob = "0.3.1" dirs = "5" +# Random number stuff +rand = "0.8.5" # Interacting with GitHub octocrab = "0.38.0" diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs index e3a14537..4adfb24b 100644 --- a/src-tauri/src/github/release_notes.rs +++ b/src-tauri/src/github/release_notes.rs @@ -1,3 +1,4 @@ +use rand::prelude::SliceRandom; use serde::{Deserialize, Serialize}; use std::vec::Vec; use ts_rs::TS; @@ -168,9 +169,51 @@ pub async fn generate_release_note_announcement() -> Result { let modders_info = "Mod compatibility should not be impacted"; let server_hosters_info = "REPLACE ME"; + let mut rng = rand::thread_rng(); + let attributes = vec![ + "adorable", + "amazing", + "beautiful", + "blithsome", + "brilliant", + "compassionate", + "dazzling", + "delightful", + "distinguished", + "elegant", + "enigmatic", + "enthusiastic", + "fashionable", + "fortuitous", + "friendly", + "generous", + "gleeful", + "gorgeous", + "handsome", + "lively", + "lovely", + "lucky", + "lustrous", + "marvelous", + "merry", + "mirthful", + "phantasmagorical", + "pretty", + "propitious", + "ravishing", + "sincere", + "sophisticated fellow", + "stupendous", + "vivacious", + "wonderful", + "zestful", + ]; + + let selected_attribute = attributes.choose(&mut rng).unwrap(); + // Build announcement string let return_string = format!( - r"Hello beautiful people <3 + r"Hello {selected_attribute} people <3 **Northstar `{current_ns_version}` is out!** {general_info} -- cgit v1.2.3