User.ask()

User.ask()

Bound method ask of User.

Use as a shortcut for:

client.send_message(user_id, "What is your name?")

client.wait_for_message(user_id)
Parameters:
  • text (str) – Text of the message to be sent.

  • args – The arguments to pass to the listen() method.

  • kwargs – The keyword arguments to pass to the listen() method.

Example

user.ask("What is your name?")
Returns:

Message – On success, the reply message is returned.

Raises:
  • RPCError – In case of a Telegram RPC error.

  • asyncio.TimeoutError – In case reply not received within the timeout.