0

We are building an internal bot to monitor / control our software. It is NOT exposed to the public and will be used by other team members, either directly (as a direct chat) or through a few channels depending which side of the software is on topic.

The bot should do two things:

  • reply to commands; the reply should go to the user that originated it.
  • send notices to all users / channels it is involved in.

When a message arrives, I can get the channel id and the user id; while the user id is kind of guaranteed to exist for while, what is the situation with the channel?

Can I store the channel id and broadcast messages to all channels the bot is involved in? what happens if a channel is closed? do channel ids have lifetimes?

I can't really find anything online about the best practice regarding this scenario.

Thomas
  • 10,933
  • 14
  • 65
  • 136

1 Answers1

3

I have doubt Understand what you want but it seems better know these things :

  • ID's are unique in Telegram and even in all others applications so they are lifetime
  • Channel ID , Groups ID , User ID have same behavior but their difference is on their integer. (User ID's are Positive but channels and groups are Negative. check example here)
  • Users can just send message in channels that they have admin permission in it right? Bots are same. so if your bot isn't admin anymore , the Telegram gives you error in response and you can check it and after facing that error delete that channel ID in your channels list.

I hope this information help you but if you have any other question feel free to leave a comment and I'll update the post and answer you immediately.

GameO7er
  • 2,028
  • 1
  • 18
  • 33
  • this answers the question; I was wondering if I can remember some groups and they still exist after some time – Thomas Sep 17 '19 at 18:11
  • 2
    `Supergroups` and `groups` should exist permanently if the owner don't delete them. If owner of `supergroup` leave the group , the group will be delete automatically but it's not true about group. so you can always send message to `groups` and `supergroups` except when you restricted. In that situation Telegram response message will tell you about problem. – GameO7er Sep 17 '19 at 21:12