Figgure out weater bot.getApi().getChatAdministrators(message->chat->id) is an administrator #194
|
Hello Community to me there are two missing samples: ONE: This the one to join a grouo TWO Any hints would be apreciated |
Replies: 1 comment
|
bool senderIsAdmin = false;
for (const auto& member : bot.getApi().getChatAdministrators(message->chat->id)) {
std::visit(
[&](const auto& admin) {
if (admin && admin->user && message->from && admin->user->id == message->from->id) {
senderIsAdmin = true;
}
},
member->value);
}The bot must be allowed to obtain the administrator list. If you need particular permissions, inspect the The URL |
getChatAdministrators(chatId)already returns only the owner and administrators. Compare each returned member user ID with the sender:The bot must be allowed to obtain the administrator list. If you need particular permissions, inspect the
ChatMemberAdministratoralternative; the owner is represented byChatMemberOwnerand has all administrator pri…