-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update SystemChatMessage to use serializable chat
- Loading branch information
1 parent
2be07e2
commit fa7937f
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
use crate::User; | ||
use crate::{Chat, User}; | ||
|
||
pub struct SystemChatMessage; | ||
|
||
impl SystemChatMessage { | ||
pub fn user_joined(user: &User) -> String { | ||
format!("{} joined.", user.name) | ||
let message = format!("{} joined.", user.name); | ||
|
||
Chat::from_system(&message).to_string() | ||
} | ||
|
||
pub fn user_left(user: &User) -> String { | ||
format!("{} left.", user.name) | ||
let message = format!("{} left.", user.name); | ||
|
||
Chat::from_system(&message).to_string() | ||
} | ||
} |