Hi guys, how can I check if my robot is the admin of Channel X or not?
Also, does it have access to send messages or not?
X is the username of a channel.
Use getChat to check membership and getChatMember to check permissions,
When first one fails then the bot is not added to the channel.
If variable can_post_messages in the second request result is set to true then the bot can post messages.
Technically you could do this in one request using getChatMember but have to check status variable if is either 'member', 'restricted' or 'administrator', otherwise bot is not a member of the channel.
_Bots can only be added to channels as administrators._
Thank you !
Most helpful comment
Use getChat to check membership and getChatMember to check permissions,
When first one fails then the bot is not added to the channel.
If variable can_post_messages in the second request result is set to true then the bot can post messages.
Technically you could do this in one request using
getChatMemberbut have to checkstatusvariable if is either 'member', 'restricted' or 'administrator', otherwise bot is not a member of the channel._Bots can only be added to channels as administrators._