-
Notifications
You must be signed in to change notification settings - Fork 2
Response Context Decorators
Alper Kürşat edited this page Feb 23, 2022
·
1 revision
Following methods are decorating send parameters in response context.
Method | Description |
---|---|
.to(chat_id) | Sets chat_id |
.wait(miliseconds) | Allows waiting before sending message |
.silent | Sets disable_notification: true
|
.allow | Sets allow_sending_without_reply: true
|
.protect | Sets protect_content: true
|
- These decorators will not inherited by the new context created
- Wait should used before sending.
- Sending a message resets waiting timeout.
res.wait(1000).send("Hello")
🗑 Wait after send has no effect.
res.send("Hello").wait(1000)
Following code waits 1500
ms before sent
res.wait(1000).wait(1500).send("Hello")
At the following example; both "Hello" and "World" waits 1000
ms before sent.
res.wait(1000).send("Hello")
.wait(1000).send("World")
Program immediately sends "World" and waits 1000
ms before sending "Hello".
res.wait(1000).send("Hello")
.send("World")
Program waits 1000
ms before sending "Hello".
After telegram responds, program waits 1000
ms again
then sends "World"
res.wait(1000).send("Hello")
.sent.wait(1000).send("World")