From 8fee150c411466e07bb9e210e6583ef3a018e8a4 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 8 Jul 2024 05:48:33 +0200 Subject: [PATCH] Hide suffix in `/help` if in a private chat --- src/telegram/commands/help.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/telegram/commands/help.rs b/src/telegram/commands/help.rs index 82294185..763200c8 100644 --- a/src/telegram/commands/help.rs +++ b/src/telegram/commands/help.rs @@ -57,7 +57,12 @@ pub async fn handler_specific(bot: &Bot, message: &Message, target: &str) -> Com None => anyhow::bail!("Non è stato possibile trovare il comando specificato."), }; - let text = format!("❓ Il comando {}{}:\n\n{}", target.command, suffix, target.description); + let display_suffix = match message.chat.is_private() { + false => &suffix, + true => "", + }; + + let text = format!("❓ Il comando {}{}:\n\n{}", target.command, display_suffix, target.description); let _reply = bot .send_message(message.chat.id, text)