Add timeout to qalc command

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/4/head
trivernis 3 years ago
parent e11ff3f72f
commit e4a8334b63
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

2
Cargo.lock generated

@ -2050,7 +2050,7 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tobi-rs"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"aspotify",
"chrono",

@ -1,6 +1,6 @@
[package]
name = "tobi-rs"
version = "0.1.2"
version = "0.1.3"
authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018"

@ -30,6 +30,10 @@ async fn qalc(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
description +=
"\nRead the [Qalculate! Manual](https://qalculate.github.io/manual/index.html)";
}
if &result == "aborted\n" {
description =
"Calculation aborted after timeout. Try a less complex calculation.".to_string();
}
msg.channel_id
.send_message(ctx, |f| {

@ -4,6 +4,6 @@ use crate::utils::process::{run_command_async, sanitize_argument};
/// Runs the qalc command with the given expression
pub async fn qalc(expression: &str) -> BotResult<String> {
let expression = sanitize_argument(expression, true)?;
let result = run_command_async("qalc", &[&*expression]).await?;
let result = run_command_async("qalc", &["-m", "1000", &*expression]).await?;
Ok(result)
}

Loading…
Cancel
Save