fix: use tgdatabase bot again

This commit is contained in:
AlexeyZavar 2025-07-06 18:50:10 +03:00
parent 48e961392d
commit 91224d8a1c
2 changed files with 14 additions and 16 deletions

View file

@ -125,5 +125,4 @@ Enjoy using **AyuGram**? Consider sending us a tip!
### Bots ### Bots
- [TelegramDB](https://t.me/tgdatabase) for username lookup by ID (until closing free inline mode at 25 May 2025) - [TelegramDB](https://t.me/tgdatabase) for username lookup by ID
- [usinfobot](https://t.me/usinfobot) for username lookup by ID

View file

@ -40,9 +40,9 @@
namespace { namespace {
constexpr auto usernameResolverBotId = 189165596L; constexpr auto usernameResolverBotId = 8001593505L;
const auto usernameResolverBotUsername = QString("usinfobot"); const auto usernameResolverBotUsername = QString("TgDBSearchBot");
const auto usernameResolverEmpty = QString("¯\\_(ツ)_/¯"); const auto usernameResolverEmpty = QString("Error, username or id invalid/not found.");
} }
@ -656,22 +656,21 @@ void searchUser(long long userId, Main::Session *session, bool searchUserFlag, c
return QString(); return QString();
}); });
if (text.isEmpty() || text.startsWith(usernameResolverEmpty)) { if (text.isEmpty() || text.contains(usernameResolverEmpty)) {
continue; continue;
} }
ID id = 0; // 👤 ID id = 0; // 🆔
QString title; // 👦🏻 QString title; // 🏷
QString username; // 🌐 QString username; // 📧
for (auto &line : text.split('\n')) { for (auto &line : text.split('\n')) {
line = line.replace("", ""); if (line.startsWith("🆔")) {
if (line.startsWith("👤")) { id = line.mid(line.indexOf(": ") + 2).toLongLong();
id = line.mid(line.indexOf(' ') + 1).toLongLong(); } else if (line.startsWith("🏷")) {
} else if (line.startsWith("👦🏻")) { title = line.mid(line.indexOf(": ") + 2);
title = line.mid(line.indexOf(' ') + 1); } else if (line.startsWith("📧")) {
} else if (line.startsWith("🌐")) { username = line.mid(line.indexOf(": ") + 2);
username = line.mid(line.indexOf(' ') + 1);
} }
} }