mirror of
https://github.com/InsanusMokrassar/docs.git
synced 2025-10-16 21:00:18 +00:00
deploy: f7a2359066
This commit is contained in:
@@ -1180,8 +1180,8 @@
|
||||
<p>So, in most cases all your request calls with simplified api of this library (like <code>bot.getMe()</code>) will looks like <code>bot.execute(GetMe)</code>. Result of these calls is defined in type of any request (for example, for <a href="https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/bot/GetMe.kt">GetMe</a> request the result type is <a href="https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt#L101">ExtendedBot</a>). As a result, you can avoid any extension api (like <a href="api-extensions.html">special API extensions</a>) and use low level request with full controlling of the whole logic flow.</p>
|
||||
<h2 id="how-to-handle-updates">How to handle updates<a class="headerlink" href="#how-to-handle-updates" title="Permanent link">¶</a></h2>
|
||||
<p>As was written above, it will require some request:</p>
|
||||
<pre><code class="language-kotlin">val updates = bot.execute(GetUpdates())
|
||||
</code></pre>
|
||||
<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="kd">val</span><span class="w"> </span><span class="nv">updates</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bot</span><span class="p">.</span><span class="na">execute</span><span class="p">(</span><span class="n">GetUpdates</span><span class="p">())</span>
|
||||
</span></code></pre></div>
|
||||
<p>Result type of <a href="https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/GetUpdates.kt#L24">GetUpdates</a> request is <a href="https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/abstracts/Update.kt#L13">Update</a>. You may find <em>inheritors</em> of this interface in <a href="https://tgbotapi.inmo.dev/docs/dev.inmo.tgbotapi.types.update.abstracts/-update/index.html">Update kdocs</a>.</p>
|
||||
<h2 id="what-is-next">What is next?<a class="headerlink" href="#what-is-next" title="Permanent link">¶</a></h2>
|
||||
<p>As was said above, you may look into our <a href="api-extensions.html">API extensions</a> in case you wish to use more high-level functions instead of <code>bot.execute(SomeRequest())</code>. Besides, it will be very useful to know more about <a href="../updates">updates retrieving</a>.</p>
|
||||
|
Reference in New Issue
Block a user