mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
Refactor: Send system messages directly from content.
This commit is contained in:
@@ -43,6 +43,19 @@ pub enum Content {
|
||||
SystemMessage(SystemMessage),
|
||||
}
|
||||
|
||||
impl Content {
|
||||
pub async fn send_as_system(self, target: &Channel) -> Result<()> {
|
||||
Message::create(
|
||||
"00000000000000000000000000".to_string(),
|
||||
target.id().to_string(),
|
||||
self,
|
||||
None
|
||||
)
|
||||
.publish(&target)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Message {
|
||||
#[serde(rename = "_id")]
|
||||
|
||||
Reference in New Issue
Block a user