JSON system messages.

This commit is contained in:
Paul
2021-02-19 14:03:41 +00:00
parent 10cac358a9
commit 5baf85a8e9
3 changed files with 6 additions and 3 deletions

View File

@@ -102,7 +102,8 @@ pub async fn req(user: User, target: Ref) -> Result<()> {
Message::create(
"00000000000000000000000000".to_string(),
id.clone(),
format!("<@{}> left the group.", user.id),
// ! FIXME: make a schema for this
format!("{{\"type\":\"user_left\",\"id\":\"{}\"}}", user.id),
)
.publish(&target)
.await

View File

@@ -59,7 +59,8 @@ pub async fn req(user: User, target: Ref, member: Ref) -> Result<()> {
Message::create(
"00000000000000000000000000".to_string(),
id.clone(),
format!("<@{}> added <@{}> to the group.", user.id, member.id),
// ! FIXME: make a schema for this
format!("{{\"type\":\"user_added\",\"id\":\"{}\",\"by\":\"{}\"}}", member.id, user.id),
)
.publish(&channel)
.await

View File

@@ -56,7 +56,8 @@ pub async fn req(user: User, target: Ref, member: Ref) -> Result<()> {
Message::create(
"00000000000000000000000000".to_string(),
id.clone(),
format!("<@{}> removed <@{}> from the group.", user.id, member.id),
// ! FIXME: make a schema for this
format!("{{\"type\":\"user_remove\",\"id\":\"{}\",\"by\":\"{}\"}}", member.id, user.id),
)
.publish(&channel)
.await