mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Handle updateBotCommands.
This commit is contained in:
@@ -120,6 +120,15 @@ bool UpdateBotCommands(
|
||||
return result;
|
||||
}
|
||||
|
||||
bool UpdateBotCommands(
|
||||
base::flat_map<UserId, std::vector<BotCommand>> &commands,
|
||||
UserId botId,
|
||||
const MTPVector<MTPBotCommand> &data) {
|
||||
return data.v.isEmpty()
|
||||
? commands.remove(botId)
|
||||
: UpdateBotCommands(commands[botId], data);
|
||||
}
|
||||
|
||||
bool UpdateBotCommands(
|
||||
base::flat_map<UserId, std::vector<BotCommand>> &commands,
|
||||
const MTPVector<MTPBotInfo> &data) {
|
||||
@@ -132,12 +141,7 @@ bool UpdateBotCommands(
|
||||
if (!filled.emplace(id).second) {
|
||||
LOG(("API Error: Two BotInfo for a single bot."));
|
||||
return;
|
||||
}
|
||||
if (data.vcommands().v.isEmpty()) {
|
||||
if (commands.remove(id)) {
|
||||
result = true;
|
||||
}
|
||||
} else if (UpdateBotCommands(commands[id], data.vcommands())) {
|
||||
} else if (UpdateBotCommands(commands, id, data.vcommands())) {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user