mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-24 20:14:19 +00:00
Ensure empty quotes can't be added to the Diario
This commit is contained in:
parent
a72f0ee43d
commit
fccc97bca2
1 changed files with 3 additions and 1 deletions
|
@ -4,10 +4,10 @@ use std::str::FromStr;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use teloxide::Bot;
|
|
||||||
use teloxide::payloads::SendMessageSetters;
|
use teloxide::payloads::SendMessageSetters;
|
||||||
use teloxide::prelude::Requester;
|
use teloxide::prelude::Requester;
|
||||||
use teloxide::types::{Message, ParseMode, ReplyParameters};
|
use teloxide::types::{Message, ParseMode, ReplyParameters};
|
||||||
|
use teloxide::Bot;
|
||||||
|
|
||||||
use crate::interfaces::database::models::Diario;
|
use crate::interfaces::database::models::Diario;
|
||||||
use crate::interfaces::database::models::RoyalnetUser;
|
use crate::interfaces::database::models::RoyalnetUser;
|
||||||
|
@ -50,6 +50,8 @@ impl FromStr for DiarioArgs {
|
||||||
DiarioArgs { warning, quote, quoted, context }
|
DiarioArgs { warning, quote, quoted, context }
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
anyhow::ensure!(!s.is_empty(), "La citazione specificata non deve essere vuota.");
|
||||||
|
|
||||||
let warning = None;
|
let warning = None;
|
||||||
let quote = s.to_string();
|
let quote = s.to_string();
|
||||||
let quoted = None;
|
let quoted = None;
|
||||||
|
|
Loading…
Reference in a new issue