de-global services from admin
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
7a3cc3941e
commit
7e50db4193
37 changed files with 1131 additions and 1127 deletions
|
@ -1,33 +1,29 @@
|
|||
use ruma::events::room::message::RoomMessageEventContent;
|
||||
|
||||
use crate::Result;
|
||||
use crate::{admin_command, admin_command_dispatch, Result};
|
||||
|
||||
#[admin_command_dispatch]
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub(crate) enum TesterCommand {
|
||||
Tester,
|
||||
Timer,
|
||||
}
|
||||
|
||||
pub(super) async fn process(command: TesterCommand, body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
match command {
|
||||
TesterCommand::Tester => tester(body).await,
|
||||
TesterCommand::Timer => timer(body).await,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[rustfmt::skip]
|
||||
#[allow(unused_variables)]
|
||||
async fn tester(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
#[admin_command]
|
||||
async fn tester(&self) -> Result<RoomMessageEventContent> {
|
||||
|
||||
Ok(RoomMessageEventContent::notice_plain("completed"))
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[rustfmt::skip]
|
||||
async fn timer(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
#[admin_command]
|
||||
async fn timer(&self) -> Result<RoomMessageEventContent> {
|
||||
let started = std::time::Instant::now();
|
||||
timed(&body);
|
||||
timed(self.body);
|
||||
|
||||
let elapsed = started.elapsed();
|
||||
Ok(RoomMessageEventContent::notice_plain(format!("completed in {elapsed:#?}")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue