Question
I Want to check if my bot is admin on a channel or not without sending message.
I have the channel username.
I've searched a lot but I found nothing concrete !
Thanks !
You can try with that:
bot.getChatMember(message.chat.id, message.from.id).then(function (data) {
if (data.status == "administrator") {
// is admin
}
});
I don't know if it works with bots, but the only alternative that can works is to send a message and check for errors...
Thanks @sidelux ! I'll try it !
@sidelux

That is what I get !
Ok @HRNaudZ, so you can try with:
var isAdmin = 1;
bot.getChatMember(message.chat.id, message.from.id).then(function (data) {
if (data.status != "administrator")
isAdmin = 0;
}).catch(function(e) {
if (err.message.indexOf("CHAT_ADMIN_REQUIRED") != -1)
isAdmin = 0;
});
You can try with that:
bot.getChatMember(message.chat.id, message.from.id).then(function (data) { if (data.status == "administrator") { // is admin } });I don't know if it works with bots, but the only alternative that can works is to send a message and check for errors...
Thanks @sidelux , it's finally working, I just have to wait a bit.
Most helpful comment
Thanks @sidelux , it's finally working, I just have to wait a bit.