2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 23:15:59 +00:00

Support similar bots section.

This commit is contained in:
John Preston
2025-01-10 11:26:07 +04:00
parent 232077b919
commit 6ff5e221ea
17 changed files with 226 additions and 157 deletions

View File

@@ -911,6 +911,16 @@ void PeerData::fullUpdated() {
setLoadedStatus(LoadedStatus::Full);
}
UserData *PeerData::asBot() {
return isBot() ? static_cast<UserData*>(this) : nullptr;
}
const UserData *PeerData::asBot() const {
return isBot()
? static_cast<const UserData*>(this)
: nullptr;
}
UserData *PeerData::asUser() {
return isUser() ? static_cast<UserData*>(this) : nullptr;
}
@@ -1131,6 +1141,13 @@ EmojiStatusId PeerData::emojiStatusId() const {
return _emojiStatusId;
}
bool PeerData::isBot() const {
if (const auto user = asUser()) {
return user->isBot();
}
return false;
}
bool PeerData::isSelf() const {
if (const auto user = asUser()) {
return (user->flags() & UserDataFlag::Self);