mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Fix total users chat command, add help command
This commit is contained in:
@@ -33,6 +33,7 @@ pub enum ChatOperation {
|
||||
pub enum BuiltInChatOperation {
|
||||
OnlineUsers,
|
||||
TotalUsers,
|
||||
Help,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1337,4 +1337,15 @@ impl super::ChatUser for UserData {
|
||||
Err(crate::data::error_codes::ChatErrorCodes::DoesNotExist as i16)
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_total_registered_users(&self) -> Result<u64, polariton_server::operations::SimpleOpError> {
|
||||
self.db.user_count().await
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to retrieve total user count for {}: {}", self.account.id, e);
|
||||
polariton_server::operations::SimpleOpError::with_message(
|
||||
crate::data::error_codes::ChatErrorCodes::UnexpectedError as i16,
|
||||
format!("Failed to retrieve total user count: {}", e),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@ pub trait ChatUser: CommonUser {
|
||||
//async fn has_pending_sanctions(&self) -> Result<bool, i16>;
|
||||
async fn get_sanctions(&self, username: String) -> Result<polariton::operation::Typed<()>, i16>;
|
||||
async fn set_sanction(&self, sanction: SetSanction) -> Result<(), i16>;
|
||||
async fn get_total_registered_users(&self) -> Result<u64, polariton_server::operations::SimpleOpError>;
|
||||
}
|
||||
|
||||
pub struct SetSanction {
|
||||
|
||||
Reference in New Issue
Block a user