private user to avoid be recorded

This commit is contained in:
senset 2022-06-29 14:28:25 +08:00
parent 85398a6e84
commit 1c65761aff
2 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
pub const BOT_TEXT_MESSAGE_ONLY: &'static str = "仅支持文本信息"; pub const BOT_TEXT_MESSAGE_ONLY: &'static str = "仅支持文本信息";
pub const BOT_TEXT_FORWARDED_ONLY: &'static str = "仅支持转发信息"; pub const BOT_TEXT_FORWARDED_ONLY: &'static str = "仅支持转发信息";
pub const BOT_TEXT_USER_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_NO_BOT: &'static str = "不支持 bot 消息";
pub const BOT_TEXT_NOTED: &'static str = "✅ `{data}` 已记录"; 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 命令开启或者关闭提醒"; 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 命令开启或者关闭提醒";

View File

@ -294,6 +294,9 @@ impl BotServer {
ForwardedFrom::User(_) => { ForwardedFrom::User(_) => {
self.send_text_reply(message, BOT_TEXT_NO_BOT).await; 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; self.send_text_message(message, BOT_TEXT_USER_ONLY).await;
} }