mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-07-08 13:04:06 +00:00
Simplify SQL command. Add limit.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
//use crate::commands::Command;
|
||||
use crate::commands::{Execute, Here, Markov, MarkovAll, Omedeto, Sql, Top};
|
||||
use crate::commands::{Code, Execute, Here, Markov, MarkovAll, Omedeto, Sql, Top};
|
||||
use crate::db;
|
||||
use crate::errors;
|
||||
use crate::utils;
|
||||
@ -31,49 +31,60 @@ pub async fn handler(
|
||||
Here {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run(api, message)
|
||||
.run(&api, &message)
|
||||
.await?
|
||||
}
|
||||
s if s.to_string().starts_with("/sql") => {
|
||||
s if s.to_string().starts_with("/sql") => match {
|
||||
Sql {
|
||||
data: s.replace("/sql ", ""),
|
||||
}
|
||||
.run(api, message)
|
||||
.await?
|
||||
}
|
||||
.run(&api, &message)
|
||||
.await
|
||||
} {
|
||||
Ok(_) => debug!("/sql command sent to {}", message.chat.id()),
|
||||
Err(e) => {
|
||||
api.send(
|
||||
message
|
||||
.text_reply(format!("Error: {:#?}", e))
|
||||
.parse_mode(ParseMode::Html),
|
||||
)
|
||||
.await?;
|
||||
()
|
||||
}
|
||||
},
|
||||
"/top" => {
|
||||
Top {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run(api, message)
|
||||
.run(&api, &message)
|
||||
.await?
|
||||
}
|
||||
"/stat" => {
|
||||
Top {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run(api, message)
|
||||
.run(&api, &message)
|
||||
.await?
|
||||
}
|
||||
"/markov_all" => {
|
||||
MarkovAll {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run(api, message)
|
||||
.run(&api, &message)
|
||||
.await?
|
||||
}
|
||||
"/markov" => {
|
||||
Markov {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run(api, message)
|
||||
.run(&api, &message)
|
||||
.await?
|
||||
}
|
||||
"/omedeto" => {
|
||||
Omedeto {
|
||||
data: "".to_string(),
|
||||
}
|
||||
.run_mystem(api, message, mystem)
|
||||
.run_mystem(&api, &message, mystem)
|
||||
.await?
|
||||
}
|
||||
_ => (),
|
||||
|
Reference in New Issue
Block a user