diff --git a/src/admin/server/mod.rs b/src/admin/server/mod.rs index 254735a3..584d3234 100644 --- a/src/admin/server/mod.rs +++ b/src/admin/server/mod.rs @@ -40,6 +40,11 @@ pub(crate) enum ServerCommand { /// - List database files ListDatabaseFiles, + /// - Send a message to the admin room. + AdminNotice { + message: Vec, + }, + #[cfg(conduit_mods)] /// - Hot-reload the server Reload, @@ -62,6 +67,9 @@ pub(crate) async fn process(command: ServerCommand, body: Vec<&str>) -> Result list_backups(body).await?, ServerCommand::BackupDatabase => backup_database(body).await?, ServerCommand::ListDatabaseFiles => list_database_files(body).await?, + ServerCommand::AdminNotice { + message, + } => admin_notice(body, message).await?, #[cfg(conduit_mods)] ServerCommand::Reload => reload(body).await?, ServerCommand::Shutdown => shutdown(body).await?, diff --git a/src/admin/server/server_commands.rs b/src/admin/server/server_commands.rs index c9daedc4..79e02e17 100644 --- a/src/admin/server/server_commands.rs +++ b/src/admin/server/server_commands.rs @@ -98,6 +98,13 @@ pub(crate) async fn list_database_files(_body: Vec<&str>) -> Result, message: Vec) -> Result { + let message = message.join(" "); + services().admin.send_text(&message).await; + + Ok(RoomMessageEventContent::notice_plain("Notice was sent to #admins")) +} + #[cfg(conduit_mods)] pub(crate) async fn reload(_body: Vec<&str>) -> Result { services().server.reload()?; diff --git a/src/service/admin/mod.rs b/src/service/admin/mod.rs index ddc3606f..0c949937 100644 --- a/src/service/admin/mod.rs +++ b/src/service/admin/mod.rs @@ -92,7 +92,7 @@ impl Service { } pub async fn send_text(&self, body: &str) { - self.send_message(RoomMessageEventContent::text_plain(body)) + self.send_message(RoomMessageEventContent::text_markdown(body)) .await; }