diff --git a/src/messages.rs b/src/messages.rs index da1db7f..2c149d2 100644 --- a/src/messages.rs +++ b/src/messages.rs @@ -1,6 +1,7 @@ pub const BOT_TEXT_MESSAGE_ONLY: &'static str = "仅支持文本信息"; pub const BOT_TEXT_FORWARDED_ONLY: &'static str = "仅支持转发信息"; pub const BOT_TEXT_USER_ONLY: &'static str = "仅支持用户信息"; +pub const BOT_TEXT_USER_PRIVATE: &'static str = "由于用户隐私设置,无法记录此人消息"; pub const BOT_TEXT_NO_BOT: &'static str = "不支持 bot 消息"; pub const BOT_TEXT_NOTED: &'static str = "✅ `{data}` 已记录"; pub const BOT_TEXT_NOTICE: &'static str = "[{username}](tg://user?id={user_id}) 转发了你的 `{data}`\n\n\t你可以使用 /list 命令查看自己或者他人被记录的信息\n\t你可以使用 /del 命令删除某条自己的信息\n\t你也可以使用 /mute 或者 /unmute 命令开启或者关闭提醒"; diff --git a/src/telegram_bot.rs b/src/telegram_bot.rs index 37eeac8..9c13dc8 100644 --- a/src/telegram_bot.rs +++ b/src/telegram_bot.rs @@ -294,6 +294,9 @@ impl BotServer { ForwardedFrom::User(_) => { self.send_text_reply(message, BOT_TEXT_NO_BOT).await; } + ForwardedFrom::SenderName(_) => { + self.send_text_reply(message, BOT_TEXT_USER_PRIVATE).await; + } _ => { self.send_text_message(message, BOT_TEXT_USER_ONLY).await; }