added length check to timer creation
This commit is contained in:
parent
632d01f503
commit
bfc48a986d
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1316,7 +1316,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reminder_rs"
|
name = "reminder_rs"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "reminder_rs"
|
name = "reminder_rs"
|
||||||
version = "1.3.0"
|
version = "1.3.1"
|
||||||
authors = ["jellywx <judesouthworth@pm.me>"]
|
authors = ["jellywx <judesouthworth@pm.me>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
@ -719,12 +719,23 @@ async fn timer(ctx: &Context, msg: &Message, args: String) {
|
|||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
.unwrap_or(format!("New timer #{}", count + 1));
|
.unwrap_or(format!("New timer #{}", count + 1));
|
||||||
|
|
||||||
Timer::create(&name, owner, &pool).await;
|
if name.len() <= 32 {
|
||||||
|
Timer::create(&name, owner, &pool).await;
|
||||||
|
|
||||||
let _ = msg
|
let _ = msg
|
||||||
.channel_id
|
.channel_id
|
||||||
.say(&ctx, lm.get(&language, "timer/success"))
|
.say(&ctx, lm.get(&language, "timer/success"))
|
||||||
.await;
|
.await;
|
||||||
|
} else {
|
||||||
|
let _ = msg
|
||||||
|
.channel_id
|
||||||
|
.say(
|
||||||
|
&ctx,
|
||||||
|
lm.get(&language, "timer/name_length")
|
||||||
|
.replace("{}", &name.len().to_string()),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user