kenorb-contrib / tg

`telegram-cli` for Telegram IM
https://github.com/telegramdesktop/tdesktop
GNU General Public License v2.0
386 stars 53 forks source link

Phone verification error occurs #51

Open v4rchaem opened 2 years ago

v4rchaem commented 2 years ago

phone number: +821012341234 1638365853.511603 Notification API_64BIT_LOGIN_APP_OUTDATED_153: You are using an outdated app that is no longer supported. To access your messages, please update your app to the latest version. 1638365853.512399 Incorrect phone number

please help to solve issue

GeoIH commented 2 years ago

Hey, v4rchaem, could you solve it?

v4rchaem commented 2 years ago

no, the problem continue

GeoIH commented 2 years ago

holy craps please @kenorb help us¡¡¡

ulrickno94 commented 2 years ago

Damn, got the same error.

andrew-phi commented 2 years ago

Tg devs updated the protocol, even if you get tgcli running, it won't reveive any messages. This is a server-side issue and the client needs to be rewriteen.

burkass commented 2 years ago

@andrew-phi yes correct, currently my bot using cli not working. But no issue when sending message. And it looks like login with cli will not working. Make sure session not gone because it might be we can't login wit it anymore.

sijumanuel commented 2 years ago

same issue

juliobm commented 2 years ago

same here

abitmore commented 2 years ago

FWIW error messages when running telegram-cli -vvvv:

phone number: +xxxxxx
 *** 1638631722.367240 Sent query #7037869656658957312 of size 204 to DC 2
 *** 1638631722.461673 update 0x382dd3e4 (check=0)
 *** 1638631722.461915 Notification API_64BIT_LOGIN_APP_OUTDATED_222: You are using an outdated app that is no longer supported. To access your messages, please update your app to the latest version.
 *** 1638631722.462198 error for query 'send code' #7037869656658957312: #400 UPDATE_APP_TO_LOGIN
 *** 1638631722.462386 Incorrect phone number
uriid1 commented 2 years ago

+1 same issue

abitmore commented 2 years ago

According to the doc https://core.telegram.org/method/auth.sendCode, our code for login (auth.sendCode#768d5f4d) is on layer (version) 23.

auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode;
---functions---
auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode;

The latest layer (version) is 133 and it requires 64-bit IDs for User/Chat

auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
---functions---
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;

An upgrade to the tgl lib is required.

By the way, due to some issues I forgot, the default tgl lib in this repository (https://github.com/kenorb-contrib/tgl) stopped working for me, so I switched to https://github.com/majn/tgl, and now it no longer works either.

denimjeans commented 2 years ago

Same issue here, I belive we are now forced to use the TDlib. https://core.telegram.org/tdlib Hope someone will implement this soon.

staoran commented 2 years ago

Currently we can use Telethon, it can achieve the same effect.

burkass commented 2 years ago

@staoran can it store number and Sent that number with stored username?

staoran commented 2 years ago

@burkass Yes, it is as convenient as CLI. For more details, please see its documentation: https://docs.telethon.dev/en/latest/index.html

ViktorKravtsov commented 2 years ago

@staoran is there compliled exe-file for using on windows? Or instruction how to do this?

staoran commented 2 years ago

@ViktorKravtsov It is full platform, it is a python package, you can do anything with python. So you need to write a python script and run this script. For example, the following is my usage:

# -*- coding: utf-8 -*-
import os
import time
from telethon import TelegramClient, events, sync

api_id = [123456789]    #api_id
api_hash = ['xxxxxxxxxxxxxxxxxx']   #api_hash
session_name = api_id[:]
for num in range(len(api_id)):
    session_name[num] = "id_" + str(session_name[num])
    client = TelegramClient(session_name[num], api_id[num], api_hash[num])
    client.start()
    client.send_message("@dogss_bot", '/checkin')   #The first item is the robot ID, and the second item is the text sent 
    client.send_message("@pussr_bot", '/checkin')
    client.send_message("@BaigeiMe_Bot", '/checkin')
#   time.sleep(5)   #Delay for 5 seconds and wait for the robot to respond (usually a second response, but there may be blocking) 
#   client.send_read_acknowledge("@luxiaoxun_bot")  #Set robot response as read 
    print("Done! Session name:", session_name[num])

os._exit(0)
burkass commented 2 years ago

Issue occur again this time after put the code and same error came. Already use -q

image

zqhong commented 2 years ago

@staoran

telethon.errors.rpcerrorlist.ChatWriteForbiddenError: You can't write in this chat (caused by SendMessageRequest)

When I send a message to a regular user using telethon, I get an error like the one above.

Can telethon only send messages to bot?

staoran commented 2 years ago

Sorry, I haven't encountered this problem, you can go to the following places to take a look: https://stackoverflow.com/questions/65588256/how-to-send-message-to-my-channel-using-telethon https://www.google.com/search?q=You+can%27t+write+in+this+chat+(caused+by+SendMessageRequest)&oq=You+can%27t+write+in+this+chat+(caused+by+SendMessageRequest)&aqs=edge..69i57&sourceid=chrome&ie=UTF-8

zqhong @.***> 于2022年4月17日周日 15:56写道:

@staoran https://github.com/staoran

telethon.errors.rpcerrorlist.ChatWriteForbiddenError: You can't write in this chat (caused by SendMessageRequest)

When I send a message to a regular user using telethon, I get an error like the one above.

— Reply to this email directly, view it on GitHub https://github.com/kenorb-contrib/tg/issues/51#issuecomment-1100826291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB33FOXE4QEIYTPU2OXAMYLVFO73BANCNFSM5JKPLCIA . You are receiving this because you were mentioned.Message ID: @.***>

zqhong commented 2 years ago

@staoran

Hi, thanks for your help, now I can send messages to bot and normal users normally.

The related code is as follows. Note that the app_id and api_hash are obtained through the https://my.telegram.org/auth website application.

from telethon.sync import TelegramClient

if __name__ == '__main__':
    api_id = 12345
    api_hash = 'xxx'
    session_name = "session_name"

    client = TelegramClient(session_name, api_id, api_hash)
    client.start()

    client.send_message("@bot_name", '/sign')

    # Note that for this to work the phone number must be in your contacts
    user_id = client.get_peer_id('+34123456789')
    print(user_id)

    client.send_message(user_id, "hello")