telegram bot ui settings and code sending

This commit is contained in:
rustdesk
2024-06-27 16:18:41 +08:00
parent aed212d8f8
commit e79946b4e4
9 changed files with 236 additions and 62 deletions

View File

@@ -1392,6 +1392,20 @@ pub fn verify2fa(code: String) -> bool {
res
}
pub fn has_valid_bot() -> bool {
crate::auth_2fa::TelegramBot::get().map_or(false, |bot| bot.is_some())
}
pub fn verify_bot(token: String) -> String {
match crate::auth_2fa::get_chatid_telegram(&token) {
Err(err) => err.to_string(),
Ok(None) => {
"To activate the bot, simply send a message like \"hello\" to its chat.".to_owned()
}
_ => "".to_owned(),
}
}
pub fn check_hwcodec() {
#[cfg(feature = "hwcodec")]
#[cfg(any(target_os = "windows", target_os = "linux"))]