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
- [TelegramDB](https://t.me/tgdatabase) for username lookup by ID (until closing free inline mode at 25 May 2025)
- [usinfobot](https://t.me/usinfobot) for username lookup by ID
- [TelegramDB](https://t.me/tgdatabase) for username lookup by ID

View file

@ -40,9 +40,9 @@
namespace {
constexpr auto usernameResolverBotId = 189165596L;
const auto usernameResolverBotUsername = QString("usinfobot");
const auto usernameResolverEmpty = QString("¯\\_(ツ)_/¯");
constexpr auto usernameResolverBotId = 8001593505L;
const auto usernameResolverBotUsername = QString("TgDBSearchBot");
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();
});
if (text.isEmpty() || text.startsWith(usernameResolverEmpty)) {
if (text.isEmpty() || text.contains(usernameResolverEmpty)) {
continue;
}
ID id = 0; // 👤
QString title; // 👦🏻
QString username; // 🌐
ID id = 0; // 🆔
QString title; // 🏷
QString username; // 📧
for (auto &line : text.split('\n')) {
line = line.replace("", "");
if (line.startsWith("👤")) {
id = line.mid(line.indexOf(' ') + 1).toLongLong();
} else if (line.startsWith("👦🏻")) {
title = line.mid(line.indexOf(' ') + 1);
} else if (line.startsWith("🌐")) {
username = line.mid(line.indexOf(' ') + 1);
if (line.startsWith("🆔")) {
id = line.mid(line.indexOf(": ") + 2).toLongLong();
} else if (line.startsWith("🏷")) {
title = line.mid(line.indexOf(": ") + 2);
} else if (line.startsWith("📧")) {
username = line.mid(line.indexOf(": ") + 2);
}
}