How to get a list of chats which my bot is administrator on them?
Hi buddy... I wanna know that if my bot added as an administrator to a group or private chat or not. Is there any way to get chat_id of a group, super group or private channels that I've never sent any message to them? Is there any way to get chat_id from a chat join URL or something like that? Is it possible to get a list of chats which my bot is administrator on them?
So. First, if your bot is added to a group, it will receive an update containing a message of type MessageType.ServiceMessage with your bot as the new chat member. You can get your bots status in a group by using GetChatMemberAsync with the chats id and the one of your bot. AFAIK you cannot get the chat id from a link, and no, you have to keep track of the groups your bot is admin in yourself.
thank you @Olfi01 for your prompt response, but the main problem is my bot is admin on over 5000 active channels and groups so it receives a lot of updates per second! When a group or channel is private, I can't realize which update is related to my bot new chat member to get the new chat_id. and also, I can't search among received updates archive to realize it, because I don't have any specific key like channels username to inquiry.
Well, you will have to look at every update, whether you have that group in your database or not and if not, add it. I'm afraid the telegram bot api does not offer a method for that.
@Olfi01 Thank you pal...
No problem, feel free to ask anything you want or reopen this issue if you need additional information!
How to check if my bot is admin on a channel or not without sending message? Obviously i have the channel username
so there is not a function to get all chats my bot is administrator of, right?
There isn't
So. First, if your bot is added to a group, it will receive an update containing a message of type
MessageType.ServiceMessagewith your bot as the new chat member. You can get your bots status in a group by usingGetChatMemberAsyncwith the chats id and the one of your bot. AFAIK you cannot get the chat id from a link, and no, you have to keep track of the groups your bot is admin in yourself.
If someone adds my BOT to Channel as an admin Will I get notified! As I am not receiving any thing! While Someone adds My BOT to group an OnUpdate fires and I am receiving MessageType.ChatCreated. But not with Channels. IS there anything that is missing from my end to check! TIA
So. First, if your bot is added to a group, it will receive an update containing a message of type
MessageType.ServiceMessagewith your bot as the new chat member. You can get your bots status in a group by usingGetChatMemberAsyncwith the chats id and the one of your bot. AFAIK you cannot get the chat id from a link, and no, you have to keep track of the groups your bot is admin in yourself.
Can you show me how you would handle this using Telegraf.js?
So. First, if your bot is added to a group, it will receive an update containing a message of type
MessageType.ServiceMessagewith your bot as the new chat member. You can get your bots status in a group by usingGetChatMemberAsyncwith the chats id and the one of your bot. AFAIK you cannot get the chat id from a link, and no, you have to keep track of the groups your bot is admin in yourself.If someone adds my BOT to Channel as an admin Will I get notified! As I am not receiving any thing! While Someone adds My BOT to group an
OnUpdatefires and I am receivingMessageType.ChatCreated. But not with Channels. IS there anything that is missing from my end to check! TIA
Did you find anything for channel, bc I'm also facing same issue?