Heapy / kotbot

Bot for Kotlin chats in telegram.
https://t.me/tgkotbot
GNU General Public License v3.0
21 stars 3 forks source link

Chat families #3

Open r4zzz4k opened 5 years ago

r4zzz4k commented 5 years ago

As we maintain a group of chats, the following things are quite logical to sync across them:

Reports sent by users, mentioned in #2, also assume connection between several chats and admin chat.

What do you thing about adding a thing called Family, which has a list of chats and an admin chat bound to it, with accompanying family management commands and mentioned synchronization?

My high-level vision on implementation: In a chat with bot added admin can send a message /family. In response the bot would create a new family with empty chat list and current chat as an admin chat for it. In admin chat, one can send /family-add message. The bot would respond with https://telegram.me/[botname]?startgroup=[id] link. This deep link opens chat picker. On selecting the chat bot gets added to it, and the user sends /start@botname message there (which can be removed automatically if the bot is already there and has admin rights or manually if not). This way we can setup linking between a family and new chat. As soon as that's done and bot is granted admin rights, bot can synchronize mentioned items between chats.

Let me know if you approve the idea and if so, whether you have any notices on the usage flow.

r4zzz4k commented 5 years ago

By the way, right now the bot cannot do any Telegram requests in Rule implementations, so querying whether sender is an admin is impossible. Do you have a vision how that should be dealt with?

IRus commented 5 years ago

Yes, that what I implicitly assume in #2

By the way, right now the bot cannot do any Telegram requests in Rule implementations, so querying whether sender is an admin is impossible. Do you have a vision how that should be dealt with?

So here we can:

  1. Maintain list of admins/moderators/etc on server side as configuration (stored in db/configuration file/etc), so this is bot-level admin/miderator/etc
  2. Do requests to see is user admin on specific group, this is telegram-group-level admin

I think what we need for bot is bot-level admin, so this can be passed to rule easly, when needed

r4zzz4k commented 5 years ago

I see. So if we have an admin chat bound to a family of communities, it may be logical to consider it's creator as a bot-level admin (I'm thinking that the less configuration is stored by the bot itself, the less are the chances it would de-synchronise with community organization, the more useful it is for the end users. So the second way seems more appropriate to me.

But I guess at some point this can also become an option to configure. For smaller communities it's logical to allow for one family admin without admin chat at all, for larger an option to setup custom admin rules may be needed. Let's start with our specific use-case and extend that on demand.

I'll try to prototype something the following days. By the way, thanks for development instructions, it definitely helped to kick-start experimenting.

r4zzz4k commented 5 years ago

Unrelated note: did you by chance saw Jib? It could replace Dockerfile, removing the split between dist packaging and container creating. The thing I love about it is that it's able to create image without requiring root permissions.

IRus commented 5 years ago

Yes, I have. Found it interesting, but for me much easier for understanding and support keep java artifacts and docker images separate.

r4zzz4k commented 5 years ago

Got it.