From 0931cbd97dcee5e9f46edea20cfcef99f600f17f Mon Sep 17 00:00:00 2001
From: InsanusMokrassar <ovsyannikov.alexey95@gmail.com>
Date: Wed, 29 May 2024 16:31:26 +0600
Subject: [PATCH] add note about behaviour builder long polling

---
 docs/tgbotapi/logic/behaviour-builder.md | 59 ++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/docs/tgbotapi/logic/behaviour-builder.md b/docs/tgbotapi/logic/behaviour-builder.md
index ce06558..41cbc0e 100644
--- a/docs/tgbotapi/logic/behaviour-builder.md
+++ b/docs/tgbotapi/logic/behaviour-builder.md
@@ -66,3 +66,62 @@ bot.buildBehaviour {
   }
 }
 ```
+
+## Long polling
+
+In case you wish to start long polling, you have two options:
+
+* Start long polling with `buildBehaviour` additional functions
+* Start long polling from using the result of `buildBehaviour`
+
+> NOTE: **More info**
+>
+> More info about updates retrieving you may read at the [Long Polling](../updates/long-polling.md) and [Webhooks](../updates/webhooks.md)
+> articles
+
+
+### Long polling from `buildBehaviour`
+
+With prepared bot:
+
+```kotlin
+val bot = telegramBot("TOKEN")
+
+bot.buildBehaviourWithLongPolling {
+    onCommand(
+        "start",
+        requireOnlyCommandInMessage = true // it is default, but you can overwrite it with `requireOnlyCommandInMessage = false`
+    ) {
+        // ...
+    }
+}
+```
+
+Without prepared bot:
+
+```kotlin
+telegramBotWithBehaviourAndLongPolling("TOKEN") {
+    onCommand(
+        "start",
+        requireOnlyCommandInMessage = true // it is default, but you can overwrite it with `requireOnlyCommandInMessage = false`
+    ) {
+        // ...
+    }
+}
+```
+
+### Long polling from the result of behaviour building
+
+```kotlin
+val bot = telegramBot("TOKEN")
+val rootContext = bot.buildBehaviour {
+    onCommand(
+        "start",
+        requireOnlyCommandInMessage = true // it is default, but you can overwrite it with `requireOnlyCommandInMessage = false`
+    ) {
+        // ...
+    }
+}
+
+bot.longPolling(rootContext) // start listening updates
+```