aahnik / tgcf

The ultimate tool to automate custom telegram message forwarding. Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... Call it whatever you like! tgcf can fulfill your custom needs.
https://github.com/aahnik/tgcf/wiki
MIT License
1.34k stars 795 forks source link

Prominently display warnings about Telegram ToS violation when deploying to a user account. #520

Closed symmetricalboy closed 10 months ago

symmetricalboy commented 11 months ago

I personally was fully aware of what I was doing, & used an alternate account & phone number to attempt to run a user bot, but it was IMMEDIATELY banned. lol. I'm sure that some poor soul is bound to make use of your work & not realize what they could be risking with it. I think it would be more constructive to the community as a whole if you were to make an addition of several "impossible to miss" warning tool tips before a user is able to deploy to their user account. This is such a quick little addition that just makes sense.

(Also, tangential, but your code on replit is busted as of right now. I tried several other tools to grab a session string, & the one I finally got to work is available here: https://github.com/HeimanPictures/String-Session, if you'd like to take a look.)

poliandro commented 10 months ago

This is not an issue with the script, this happens for various reasons on all major frameworks (telethon, pyrogram, etc.). Some users abuse Telegram API and the company has taken measures against. Sometime Telegram bans users coming from countries with high rate of abuses, sometime bans certain IP ranges, they ban more virtual numbers than SIM numbers, other times they ban new accounts that make many API calls in short amount of time.

Usually using this or other programs for forwards or downloads doesn't result in bans, there are users that have forwarded messages for days without any problems. Your account has to acquire credibility with Telegram servers, use an old account, make sure you use a SIM number, use the account for some time, interact with users, upload, download and forward files for a few months, and then use this program. Most complaints that I have seen are from users that use TGCF with a new account, same complaints in Telethon and Pyrogram forums, mostly users with new accounts.

symmetricalboy commented 10 months ago

@poliandro I'm well aware of all of what you've said. I'm simply saying that it occurred to me after trying out a VoIP number & getting it banned that a warning about it would be kind, as not all people are going to know to expect this. It's nothing wrong with this particular project, per se, but a notice that you're opting to violate Telegram ToS by deploying to a user account seems worthwhile.

MobCode100 commented 10 months ago

What mode had made you banned? Live or past?

poliandro commented 10 months ago

@symmetricalboy It has nothing to do with deploying with a user accounts. It relates with using virtual numbers, new accounts etc. The warning should be about those I think. P.S. I see that you use a fork, and you added the option to forward from topics. It is working? Can you make a PR to this project?

symmetricalboy commented 10 months ago

@MobCode100 I didn't even run the script. Just getting the account signed in banned me. haha

@poliandro That's probably true. It is using user accounts with virtual numbers, not just using user accounts. explaining that you should use 1 ) not your primary account you can't stand to lose, & 2 ) an established account with a real SIM.

As for topics, it is partially working, yes. I only half-assed it. It needs more work. I don't think a pull request to this project will do very much; I think it's abandoned currently. I will return to the project later & get things working better. You are free to take a look, & I can point you to what is relevant if you wish. It is currently set in a way where you can only have a single topic ID assigned, & you are basically only allowed to run it to 1 target, but it works. It just needs to be generalized and polished.

symmetricalboy commented 10 months ago

Oh, also, if you want to deploy it, I've set it up with railway.app in mind.

poliandro commented 10 months ago

I also was banned, but not with TGCF, was thinking the same as you, use a new number to not put my main account in danger, but I wrote to Telegram and they recover my account. These bans are triggered by their securities system and they often make mistakes. When you make a complaint a human verifies, and they lift the ban.

What features are missing currently? If you plan to add those, please don't forget to make a PR, so other users can enjoy the new functionality.

MobCode100 commented 10 months ago

Maybe tg-login is very detectable? That's why telegram banned the number, while login on original telegram app is fine right?

For the warning, maybe it should just be included in the README.md file. Cause I'm not aware of that until you've made an issue here.

symmetricalboy commented 10 months ago

Eh, I didn't bother to fight the number being banned. I'm sure they'd lift it. But to be clear, it is definitely a ToS violation.

So for missing features, it should really be configured in a way so that you are able to use non-topics simultaneously with topics, send to multiple topic targets, etc. Also, the past mode is entirely broken right now. I can't recall, I think also I realized some issues with forwards, & then I got bored & haven't gotten back to the project. lol

Again, as for a PR, I will submit something when the code is good & ready, but I also intend to make my fork complete on its own, because I don't think this project is going to be updated. Pending PRs for months...

I'm not sure exactly how they sensed I was doing something to be banned. I think they possibly noticed the session string in 2 clients?

symmetricalboy commented 10 months ago

I'll get back to updating my fork eventually. I know people are interested in it. But I don't have the time for it at the moment. Just click watch on the fork, & you'll know when I'm working on it again. Feel free to message me anywhere to pester me to do it. haha

poliandro commented 10 months ago

It seems more complicated than I thought. I hope it's done some day. Why do you mean by "ToS violation"?

symmetricalboy commented 10 months ago

Terms of Service. It is not allowed by Telegram for you to automate a user account. It is fully correct for them to ban an account using this software. It isn't the way they want their platform used.

poliandro commented 10 months ago

Can you point to the ToS from official Telegram? Because I heard this before and I don't think it is accurate.

symmetricalboy commented 10 months ago

Well I'll be god damned. I scoured their ToS just now, & as far as I can tell, they do NOT ban userbots. They just are likely to ban accounts they believe are attempting to use a userbot functionality in order to spam. They don't explicitly ban them! Wow! I learned something new, thank you. But still, the warning is good, because you still risk the hassle of being banned due to the fact they are weary of anyone making a userbot. But I'm gonna request my VoIP number get unbanned now...

poliandro commented 10 months ago

It's not about userbots, it's about abusing them for spam. Userbots are legitimate and is nothing wrong with them. In fact, you cannot use TGCF in past mode without being logged as user. The Telegram API let you use either bots or userbots for automating various tasks, even official client does this for scheduling messages.

But it is true that login from unofficial clients put you under their radar, they say this explicit, but if you use it for legitimate purposes, you'll be fine. If their systems make mistakes, your account will be recovered.

MobCode100 commented 10 months ago

I guess it's more likely because telegram has put more effort in combating abuse of API. There's a lot of factors, and in the official telethon documentation also mentioned about recent increased user bans. However, there's some ways to try to avoid bans that I found in the official documentation. I also found a library opentele that might prevent bans because of using official Telegram API but it's not maintained anymore. I don't have much experience in this, the only way to know is to try.

poliandro commented 10 months ago

Yes, from Telethon FAQ I found that VoIP numbers are often banned. Have you tried the library that you mention? It has a mention that worries me: Random device information for [initConnection](https://core.telegram.org/method/initConnection) to avoid spam-detection.

What if Telegram catch you and ask you about it? Why you tried to avoid spam detection? I feel more safe using Telethon as it is, but I'm curious about that library. I don't feel safe enough to try it myself, but if anybody has tried it, please let us know about the experience.

MobCode100 commented 10 months ago

Nope, I've never tried that but maybe it'll help someone. For now I don't need to avoid spam detection but maybe in the future. Just thinking that it might be nice to have a way to avoid getting banned right after logging in. Nevertheless, it's not a serious problem.