listen(...), input(...), and waitPay(...) block the current plugin run until a matching event arrives, the wait times out, or the user sends an exit code. Payment plugins should handle timeout, cancellation, and amount mismatch explicitly.
listen(waitTime, recallTime=0, scope="")
Wait for the next user input in the same chat and account. Timeout returns an empty string "".
Wait time in milliseconds. The runtime normalizes this value: default
60000 ms, minimum 1000 ms, and usually maximum 900000 ms.Milliseconds to delay recalling the received user message. If the second argument is
'group', the SDK treats it as scope and sets recallTime to 0.Pass
'group' to allow any member in the same group to answer. Omit it to wait only for the current user.input(waitTime, recallTime=0, scope="")
input(...) is an alias of listen(...) with the same parameters and return value.
input(...) returns text content; read media from sender.getMediaItems().
waitPay(exitcode, timeout, amount=None)
Wait for a payment event or exit code. It registers the payment wait with the current runtime IM, account, chat, and user. If payment configuration is unavailable, it falls back to legacy payment-event waiting.
Exit code. During the wait, the exact same user text returns this string and ends the wait. Pass an empty string to disable user cancellation.
Wait time in milliseconds. The runtime normalizes it with the input wait limit, usually maximum
900000 ms.Expected amount. When passed, the returned payment object includes
expected_amount and amount_matched.atWaitPay()
atWaitPay() returns whether the current run is waiting for payment.
Next steps
- Download files received while waiting:
Events, media, and files - Push payment notices proactively:
Proactive push