简体   繁体   English

Pyrogram UserBot 检查用户名是否免费

[英]Pyrogram UserBot check if a username is free

I'm coding with python a telegram UserBot for checking if a username is free .我正在用 python 编写一个电报 UserBot来检查用户名是否免费 I have a list of usernames in my database.我的数据库中有一个用户名列表。 The bot in local works fine but when I up it on Hetzner it has a bug .本地的机器人工作正常,但是当我在Hetzner 上安装它时,它有一个错误 For checking an username there is a loop that send a request to telegram website.为了检查用户名,有一个循环向电报网站发送请求。

while True:
    
    vab = "icon_user"
    db = cluster["users"]
    collection = db["list2"]
    results = collection.find()
    for result in results:
        usern = str(result["_id"])           
        url = 'https://t.me/{}'.format(usern[1:])            
        r = requests.get(url)
        if vab in str(r.text) and not "400 Bad Request" in str(r.text):

The if condition sometimes buggy, it returns that the username is free, even if it is busy. if 条件有时会出错,它返回用户名是空闲的,即使它很忙。 I have tried several times to change the variable that the condition checks, but I always have the same error... How can I solve this?我已尝试多次更改条件检查的变量,但我总是遇到相同的错误......我该如何解决这个问题?

I have found that Telegram sometimes sends the same page to the user as if the username is free when too many requests have been sent.我发现 Telegram 有时会向用户发送相同的页面,就好像在发送了太多请求时用户名是空闲的一样。 You can try increasing the time between t.me page checks您可以尝试增加 t.me 页面检查之间的时间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM