This commit is contained in:
InsanusMokrassar 2023-06-14 07:48:24 +00:00
parent 9337350745
commit 33c1dcb693
3 changed files with 9 additions and 8 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1433,15 +1433,16 @@
<h1 id="faq">FAQ<a class="headerlink" href="#faq" title="Permanent link">&para;</a></h1>
<h2 id="how-to-filter-updates-in-some-part-of-behaviourbuilder">How to filter updates in some part of <code>BehaviourBuilder</code>?<a class="headerlink" href="#how-to-filter-updates-in-some-part-of-behaviourbuilder" title="Permanent link">&para;</a></h2>
<p>You may create subcontext with
<code>BehaviourBuilder.</code><a href="https://tgbotapi.inmo.dev/tgbotapi.behaviour_builder/dev.inmo.tgbotapi.extensions.behaviour_builder/create-sub-context.html"><code>createSubContext</code></a>
<code>BehaviourBuilder.</code><a href="https://tgbotapi.inmo.dev/tgbotapi.behaviour_builder/dev.inmo.tgbotapi.extensions.behaviour_builder/create-sub-context-and-do-with-updates-filter.html"><code>createSubContextAndDoWithUpdatesFilter</code></a>
and pass there <code>updatesUpstreamFlow</code> parameter with any operations over parent behaviour builder:</p>
<div class="language-kotlin highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="n">buildBehaviourWithLongPolling</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="w"> </span><span class="n">createSubContext</span><span class="p">(</span>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="w"> </span><span class="n">updatesUpstreamFlow</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">filter</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cm">/* some condition */</span><span class="w"> </span><span class="p">}</span>
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="w"> </span><span class="n">onCommand</span><span class="p">()</span><span class="w"> </span><span class="c1">//...</span>
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="p">}</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="w"> </span><span class="n">createSubContextAndDoWithUpdatesFilter</span><span class="p">(</span>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="w"> </span><span class="n">updatesUpstreamFlow</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">filter</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="cm">/* some condition */</span><span class="w"> </span><span class="p">},</span>
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span class="w"> </span><span class="n">stopOnCompletion</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">false</span><span class="w"> </span><span class="c1">// disable stopping of sub context after setup</span>
</span><span id="__span-0-5"><a id="__codelineno-0-5" name="__codelineno-0-5" href="#__codelineno-0-5"></a><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-0-6"><a id="__codelineno-0-6" name="__codelineno-0-6" href="#__codelineno-0-6"></a><span class="w"> </span><span class="n">onCommand</span><span class="p">()</span><span class="w"> </span><span class="c1">//...</span>
</span><span id="__span-0-7"><a id="__codelineno-0-7" name="__codelineno-0-7" href="#__codelineno-0-7"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-0-8"><a id="__codelineno-0-8" name="__codelineno-0-8" href="#__codelineno-0-8"></a><span class="p">}</span>
</span></code></pre></div>
<h3 id="additional-info">Additional info<a class="headerlink" href="#additional-info" title="Permanent link">&para;</a></h3>
<ul>