J-Rios / TLG_JoinCaptchaBot

Telegram Bot to verify if users joining a group are human. The Bot sends an image captcha for each new user and kicks any of them who can't solve the captcha in a specified time.
GNU General Public License v3.0
532 stars 218 forks source link

[Request] Configure Bot group settings through private chat (similar to @MissRose_bot's functionality) #54

Closed K0media closed 3 years ago

K0media commented 4 years ago

@MissRose_bot has the feature to connect remotely to the desired group to manage the bot's settings. Being linked to the group, you can send and get commands by calling them privately, once it's connected to the group you need to do the alterations and management.

I'm currently using @join_captcha_bot because Rose lacks more features as yours have. And will probably keep it this way for some time since it suits my needs.

You can connect to the group remotely with the /connect command.

Example: /connect -1001235155926

Which -1001235155926 is the group !id.

Could that be possible?

Or you could integrate with Rose, by any chance... If that's even possible.

Thanks!

J-Rios commented 4 years ago

I'm not familiar with Rose Bot functionality... What you expect is to be able to config different groups from Bot private chat? If that is the case, note that then Bot needs to store Admin info from groups...

I don't see any benefit in doing it, groups can be configured from inside the corresponding groups. PR about this can be accepted f anyone want to implement it.

There is no way to integration with other Bots, even less if those are Closed source.

K0media commented 4 years ago

I see. Thanks for the info. I'll keep an eye here to see if people will agree with this idea or not.

However, iirc, there are some opensource bots that already have that open code to be "copied" and ported to other bots. I can provide more sources if needed.

PS: I'm not a programmer, but I might know a few basics.

Marzal commented 3 years ago

Shieldy allows to at least show the config of the bot in a group to not SPAM the group.

Not sure if the code could help some:

https://github.com/1inch/shieldy/blob/master/src/commands/viewConfig.ts

By the way, great job with JoinCaptchaBot :+1:

J-Rios commented 3 years ago

Thanks,

Problem here is not related to implementation, neither the needs of source code.The issue is related to what this feature internally involves...

If we want to configure a group from a Bot private conversation, then it must allow this configuration just by an Admin of that specific group, and not to anybody. Here, if we need to know if the user that speak to the Bot is an Admin of that group, then the Bot have two ways to handle this:

Maybe the best way to implement this is go through "A option", but implementing some kind of config command limitation that makes a user to won't be able to config something if it is not allowed to do in this group for some time (this will safe avoid the malicious floods).

Of course, just to show a group config doesn't needs to know if the user who ask is an Admin of that group, but then it seems more like a patch for a half way feature, that could conflict in the future if we implement some really private chat config behavior. It is related, but "show group info request" should be good to be placed in an independent issue and not in this one.

Best Regards.

Marzal commented 3 years ago

Thanks for the reply and the analysis (and obviously the bot).

If option A is consider along the road, I don't think that expending time in just "show group info" is worth the time.

J-Rios commented 3 years ago

Yeah, I think it can be done in that way...

Maybe some kind of /manage command to setup the group that the user want to configure (here the Bot will check if it is a valid Admin) and then set the commands of the groups...

/manage -1234567890
/time 1 min
/captcha_mode random
...

P.D. Thanks for the donation :heart:

Marzal commented 3 years ago

Yeah, I think it can be done in that way...

Maybe some kind of /manage command to setup the group that the user want to configure (here the Bot will check if it is a valid Admin) and then set the commands of the groups...

/manage -1234567890
/time 1 min
/captcha_mode random
...

P.D. Thanks for the donation heart

Yeah, that would be great, I always send the commands in silent mode to not disturb the group, but the bot answers are normal messages so I try to be fast deleting the "conversation". This would be a great improvement.

PD: No hay de qué. Thanks again for the source code, the time and the online service (the bot itself).

J-Rios commented 3 years ago

Yeah, that would be great, I always send the commands in silent mode to not disturb the group, but the bot answers are normal messages so I try to be fast deleting the "conversation". This would be a great improvement.

The Bot automatically delete the config messages after 1 min to keep a clean group, so there is no need to delete it manually (only if you want to remove before 1 min). Also, Bot should be sending the messages in silent mode (it was done as feature some time ago), maybe it is broken now and is sending as normal messages?

Marzal commented 3 years ago

Yeah, that would be great, I always send the commands in silent mode to not disturb the group, but the bot answers are normal messages so I try to be fast deleting the "conversation". This would be a great improvement.

The Bot automatically delete the config messages after 1 min to keep a clean group, so there is no need to delete it manually (only if you want to remove before 1 min). Also, Bot should be sending the messages in silent mode (it was done as feature some time ago), maybe it is broken now and is sending as normal messages?

I will test again. I did the testing a long time ago (with another account), probably before April 2020. So it's totally possible that it's an old habit no longer necessary

UPDATE:

I may be doing something wrong but I would say that I still get sound replies from JoinCaptchaBot

J-Rios commented 3 years ago

Ok, then it must be revised.

Please let's use this new issue regarding the silent messages to keep a good track of the problem in a specific issue: https://github.com/J-Rios/TLG_JoinCaptchaBot/issues/118

Regards.

J-Rios commented 3 years ago

Done, configure Bot group settings through private chat feature implemented and added in: https://github.com/J-Rios/TLG_JoinCaptchaBot/commit/7c6a99570667d3ba73b8f27f8e54a532ec69b687

How-To

1 - Use /chatid inside the group you want to configure to get the "Group Chat ID".

/chatid

2 - Open a private chat conversation with the Bot and use /connect command to bind the private chat to configure that group (i.e. if the group chat ID is -1234567890):

/connect -1234567890

3 - Now you can configure everything you want of the group:

/time 1
/language es
/captcha_mode random

4 - Disconnect from the group once done:

/disconnect

Regards.