| 405 | } |
| 406 | |
| 407 | void UserData::setBotInfoVersion(int version) { |
| 408 | if (version < 0) { |
| 409 | // We don't support bots becoming non-bots. |
| 410 | if (botInfo) { |
| 411 | botInfo->version = -1; |
| 412 | } |
| 413 | } else if (!botInfo) { |
| 414 | botInfo = std::make_unique<BotInfo>(); |
| 415 | botInfo->version = version; |
| 416 | owner().userIsBotChanged(this); |
| 417 | } else if (botInfo->version < version) { |
| 418 | if (!botInfo->commands.empty()) { |
| 419 | botInfo->commands.clear(); |
| 420 | owner().botCommandsChanged(this); |
| 421 | } |
| 422 | botInfo->description.clear(); |
| 423 | botInfo->version = version; |
| 424 | botInfo->inited = false; |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | void UserData::setBotInfo(const MTPBotInfo &info) { |
| 429 | switch (info.type()) { |
no test coverage detected