1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-21 18:44:19 +00:00

Ensure empty quotes can't be added to the Diario

This commit is contained in:
Steffo 2024-08-25 12:53:33 +02:00
parent a72f0ee43d
commit fccc97bca2
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -4,10 +4,10 @@ use std::str::FromStr;
use anyhow::Context;
use once_cell::sync::Lazy;
use regex::Regex;
use teloxide::Bot;
use teloxide::payloads::SendMessageSetters;
use teloxide::prelude::Requester;
use teloxide::types::{Message, ParseMode, ReplyParameters};
use teloxide::Bot;
use crate::interfaces::database::models::Diario;
use crate::interfaces::database::models::RoyalnetUser;
@ -50,6 +50,8 @@ impl FromStr for DiarioArgs {
DiarioArgs { warning, quote, quoted, context }
}
None => {
anyhow::ensure!(!s.is_empty(), "La citazione specificata non deve essere vuota.");
let warning = None;
let quote = s.to_string();
let quoted = None;