mark the server user bot as online/offline on shutdown/startup
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
9eace1fbbb
commit
8eec78e9e0
1 changed files with 16 additions and 0 deletions
|
@ -123,6 +123,14 @@ impl Services {
|
|||
.start()
|
||||
.await?;
|
||||
|
||||
// set the server user as online
|
||||
if self.server.config.allow_local_presence {
|
||||
_ = self
|
||||
.presence
|
||||
.ping_presence(&self.globals.server_user, &ruma::presence::PresenceState::Online)
|
||||
.await;
|
||||
}
|
||||
|
||||
debug_info!("Services startup complete.");
|
||||
Ok(Arc::clone(self))
|
||||
}
|
||||
|
@ -130,6 +138,14 @@ impl Services {
|
|||
pub async fn stop(&self) {
|
||||
info!("Shutting down services...");
|
||||
|
||||
// set the server user as offline
|
||||
if self.server.config.allow_local_presence {
|
||||
_ = self
|
||||
.presence
|
||||
.ping_presence(&self.globals.server_user, &ruma::presence::PresenceState::Offline)
|
||||
.await;
|
||||
}
|
||||
|
||||
self.interrupt();
|
||||
if let Some(manager) = self.manager.lock().await.as_ref() {
|
||||
manager.stop().await;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue