Closed bagi3mk closed 10 months ago
@bagi3mk What is in the variable chat?
@bagi3mk What is in the variable chat?
it's like any chat id : 683470553
anyone found a way?
This is because client.ask
is being used with the wrong arguments, probably after migrating between major releases without fixing the breaking changes.
I suppose you're using pyrogram v2
(since the property registered_handler
is named user_callback
on v1 and original_callback
on v3).
On v1
, your code is correct.
Phone_Number = await client.ask(chat,f"- قم بأرسال رقم الهاتف .")
On v2
, as stated on the release notes, pyromod started receiving tuple identifiers instead of the chat_id.
The correct code for v2 would be:
Phone_Number = await client.ask(f"- قم بأرسال رقم الهاتف .", (chat, None, None))
Note that the argument
text
comes first now.
On v3
though, it's easier:
Phone_Number = await client.ask(chat,f"- قم بأرسال رقم الهاتف .")
Just like pyromod
v1
, with no tuple identifiers and with the chat_id as first positional argument. Read the release notes for v3 here.
I suggest you to read the release notes before migrating between major releases. They always contains breaking changes (otherwise they would not be major).
i got this error
pyrogram.errors.exceptions.bad_request_400.UsernameInvalid: Telegram says: [400 USERNAME_INVALID] - The username is invalid (caused by "contacts.ResolveUsername")
when i use this code :
why???
full error: