diff --git a/bot/templates/list/event.tera b/bot/templates/list/event.tera index 835d8572..b2999d39 100644 --- a/bot/templates/list/event.tera +++ b/bot/templates/list/event.tera @@ -3,7 +3,7 @@ {{ event.details }} {% endif %} {% for member in event.members -%} -{% include "list/member" %} +{% include "list/member" -%} {% endfor %} ⏰ {{ event.time }} {#- join_prompt -#} diff --git a/entity/src/guardians.rs b/entity/src/guardians.rs index efd2ad05..f196c408 100644 --- a/entity/src/guardians.rs +++ b/entity/src/guardians.rs @@ -3,7 +3,10 @@ // Guardian //------------------------------------------------------------------------------------------------- -use {sea_orm::entity::prelude::*, std::fmt}; +use { + sea_orm::entity::prelude::*, + std::{fmt, sync::LazyLock}, +}; // Old diesel schema for reference: // table! { @@ -84,7 +87,8 @@ impl fmt::Display for Model { impl Model { pub fn format_name(&self) -> String { format!( - "{} (t.me/{}) {}", + "{} {} (t.me/{}) {}", + self.icon(), self.psn_name, self.telegram_name, self.format_destiny_rising_id() @@ -94,7 +98,7 @@ impl Model { pub fn format_destiny_rising_id(&self) -> String { if let Some(uid) = self.rising_uid { if let Some(nickname) = &self.rising_nickname { - format!("(D:R uid {} nickname {})", uid, nickname) + format!("(D:R uid {} / {})", uid, nickname) } else { format!("(D:R uid {})", uid) } @@ -106,6 +110,27 @@ impl Model { pub fn names(&self) -> (String, String) { (self.telegram_name.clone(), self.psn_name.clone()) } + + pub fn icon(&self) -> String { + static ICON_POOL: LazyLock> = LazyLock::new(|| { + vec![ + "💂🏻", + "🕵🏼", + "🧑🏽‍🏭", + "🧑‍💻", + "🧑🏼‍🚒", + "🧑🏾‍🚀", + "🥷🏾", + "🥷🏻", + "🧙🏽", + "🧝🏼", + "🧌", + "🧛🏼", + "🧟", + ] + }); + ICON_POOL[self.telegram_id.unsigned_abs() as usize % ICON_POOL.len()].into() + } } #[cfg(test)] diff --git a/entity/src/plannedactivitymembers.rs b/entity/src/plannedactivitymembers.rs index 69be1267..c467037d 100644 --- a/entity/src/plannedactivitymembers.rs +++ b/entity/src/plannedactivitymembers.rs @@ -7,7 +7,6 @@ use { culpa::throws, sea_orm::entity::prelude::*, serde::{Deserialize, Serialize}, - std::sync::LazyLock, }; // Old diesel schema for reference: @@ -101,28 +100,7 @@ impl Model { psn_name, telegram_name, rising_uid_and_nick, - icon: self.icon(), + icon: guardian.icon(), } } - - pub fn icon(&self) -> String { - static ICON_POOL: LazyLock> = LazyLock::new(|| { - vec![ - "💂🏻", - "🕵🏼", - "🧑🏽‍🏭", - "🧑‍💻", - "🧑🏼‍🚒", - "🧑🏾‍🚀", - "🥷🏾", - "🥷🏻", - "🧙🏽", - "🧝🏼", - "🧌", - "🧛🏼", - "🧟", - ] - }); - ICON_POOL[self.user_id.unsigned_abs() as usize % ICON_POOL.len()].into() - } }