This commit is contained in:
InsanusMokrassar 2023-09-11 13:41:50 +00:00
parent cfa79f4489
commit b0876ba961
5 changed files with 117 additions and 45 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,177 +2,177 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://docs.inmo.dev/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/describing/krontabscheduler.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/describing/string-format.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/introduction/faq.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/introduction/how-to-use.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/krontab/introduction/including-in-project.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/kslog/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/kslog/logging.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/kslog/setup.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/micro_utils/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/navigation/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/index.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/faq.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/dsls/keyboards.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/dsls/live-location.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/dsls/text.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/guides/keyboards.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/introduction/before-any-bot-project.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/introduction/first-bot.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/introduction/including-in-your-project.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/introduction/proxy-setup.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/api-extensions.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/behaviour-builder-with-fsm.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/behaviour-builder.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/exceptions-handling.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/files-handling.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/low-level-work-with-bots.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/media-groups.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/types-conversations.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/logic/updates-with-flows.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/updates/heroku.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/updates/long-polling.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/updates/updates-filters.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>https://docs.inmo.dev/tgbotapi/updates/webhooks.html</loc>
<lastmod>2023-09-05</lastmod>
<lastmod>2023-09-11</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

View File

@ -604,6 +604,13 @@
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#what-is-the-error-failed-to-load-class-orgslf4jimplstaticloggerbinder" class="md-nav__link">
What is the error Failed to load class "org.slf4j.impl.StaticLoggerBinder"?
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-filter-updates-in-some-part-of-behaviourbuilder" class="md-nav__link">
How to filter updates in some part of BehaviourBuilder?
@ -1826,6 +1833,13 @@
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#what-is-the-error-failed-to-load-class-orgslf4jimplstaticloggerbinder" class="md-nav__link">
What is the error Failed to load class "org.slf4j.impl.StaticLoggerBinder"?
</a>
</li>
<li class="md-nav__item">
<a href="#how-to-filter-updates-in-some-part-of-behaviourbuilder" class="md-nav__link">
How to filter updates in some part of BehaviourBuilder?
@ -1885,18 +1899,26 @@
<h1 id="faq">FAQ<a class="headerlink" href="#faq" title="Permanent link">&para;</a></h1>
<h2 id="what-is-the-error-failed-to-load-class-orgslf4jimplstaticloggerbinder">What is the error <code>Failed to load class "org.slf4j.impl.StaticLoggerBinder"</code>?<a class="headerlink" href="#what-is-the-error-failed-to-load-class-orgslf4jimplstaticloggerbinder" title="Permanent link">&para;</a></h2>
<div class="language-text highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>SLF4J: Failed to load class &quot;org.slf4j.impl.StaticLoggerBinder&quot;.
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>SLF4J: Defaulting to no-operation (NOP) logger implementation
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
</span></code></pre></div>
<p>This error is just a warning about the absence of <a href="https://www.slf4j.org">slf4j</a> setup. You may fix this error
by following to <a href="https://stackoverflow.com/a/9919375">stackoverflow answer</a></p>
<hr />
<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-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">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>
<div class="language-kotlin highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="n">buildBehaviourWithLongPolling</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="w"> </span><span class="n">createSubContextAndDoWithUpdatesFilter</span><span class="p">(</span>
</span><span id="__span-1-3"><a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-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-1-4"><a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-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-1-5"><a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-1-6"><a id="__codelineno-1-6" name="__codelineno-1-6" href="#__codelineno-1-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-1-7"><a id="__codelineno-1-7" name="__codelineno-1-7" href="#__codelineno-1-7"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-1-8"><a id="__codelineno-1-8" name="__codelineno-1-8" href="#__codelineno-1-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>
@ -1906,7 +1928,7 @@ and pass there <code>updatesUpstreamFlow</code> parameter with any operations ov
<h3 id="cases">Cases<a class="headerlink" href="#cases" title="Permanent link">&para;</a></h3>
<ul>
<li>Filtering of chats and users:
<div class="language-kotlin highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></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="nb">it</span><span class="p">.</span><span class="na">sourceChat</span><span class="p">()</span><span class="w"> </span><span class="o">?.</span><span class="na">id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">requiredChatId</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="nb">it</span><span class="p">.</span><span class="na">sourceUser</span><span class="p">()</span><span class="w"> </span><span class="o">?.</span><span class="na">id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">requiredUserId</span><span class="w"> </span><span class="p">}</span>
<div class="language-kotlin highlight"><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></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="nb">it</span><span class="p">.</span><span class="na">sourceChat</span><span class="p">()</span><span class="w"> </span><span class="o">?.</span><span class="na">id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">requiredChatId</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="nb">it</span><span class="p">.</span><span class="na">sourceUser</span><span class="p">()</span><span class="w"> </span><span class="o">?.</span><span class="na">id</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">requiredUserId</span><span class="w"> </span><span class="p">}</span>
</span></code></pre></div><ul>
<li><strong>See</strong>:<ul>
<li><a href="https://tgbotapi.inmo.dev/tgbotapi.utils/dev.inmo.tgbotapi.extensions.utils.extensions/source-chat.html">Update.sourceChat</a></li>

View File

@ -717,6 +717,13 @@
Using Ktor Client built-in proxy
</a>
</li>
<li class="md-nav__item">
<a href="#more-complex-and-flexible-variant" class="md-nav__link">
More complex and flexible variant
</a>
</li>
<li class="md-nav__item">
@ -1820,6 +1827,13 @@
Using Ktor Client built-in proxy
</a>
</li>
<li class="md-nav__item">
<a href="#more-complex-and-flexible-variant" class="md-nav__link">
More complex and flexible variant
</a>
</li>
<li class="md-nav__item">
@ -1906,6 +1920,42 @@ In the snippet above was used version <code>2.0.1</code> which is actual for <co
<li><code>ktorClientEngineFactory = OkHttp</code> - setting up engine factory of our bot. On the time of documentation filling, <code>OkHttp</code> is one of the engines in <code>Ktor</code> system which supports socks proxy. More you can read on <a href="https://ktor.io">Ktor</a> site in subparts about <a href="https://ktor.io/clients/http-client/engines.html#okhttp">engines</a> and <a href="https://ktor.io/clients/http-client/features/proxy.html">proxy</a></li>
<li><code>proxy = ProxyBuilder.socks("127.0.0.1", 1080)</code> - here we are setting up our proxy. Here was used local server which (as assumed) will connect to server like <code>shadowsocks</code></li>
</ol>
<h2 id="more-complex-and-flexible-variant">More complex and flexible variant<a class="headerlink" href="#more-complex-and-flexible-variant" title="Permanent link">&para;</a></h2>
<p>You may try to use <a href="https://ktor.io/docs/http-client-engines.html">custom engine for ktor</a>. For example:</p>
<div class="language-kotlin highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="c1">// JVM</span>
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="c1">// OkHttp engine</span>
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="c1">// Socks5 proxy</span>
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a>
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="kd">val</span><span class="w"> </span><span class="nv">bot</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">telegramBot</span><span class="p">(</span><span class="n">botToken</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-6"><a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">proxyPort</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">1080</span><span class="w"> </span><span class="c1">//your proxy port</span>
</span><span id="__span-3-7"><a id="__codelineno-3-7" name="__codelineno-3-7" href="#__codelineno-3-7"></a>
</span><span id="__span-3-8"><a id="__codelineno-3-8" name="__codelineno-3-8" href="#__codelineno-3-8"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">proxyHost</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;your proxy host&quot;</span>
</span><span id="__span-3-9"><a id="__codelineno-3-9" name="__codelineno-3-9" href="#__codelineno-3-9"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">username</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;proxy username&quot;</span>
</span><span id="__span-3-10"><a id="__codelineno-3-10" name="__codelineno-3-10" href="#__codelineno-3-10"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">password</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;proxy password&quot;</span>
</span><span id="__span-3-11"><a id="__codelineno-3-11" name="__codelineno-3-11" href="#__codelineno-3-11"></a>
</span><span id="__span-3-12"><a id="__codelineno-3-12" name="__codelineno-3-12" href="#__codelineno-3-12"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">proxyAddr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">InetSocketAddress</span><span class="p">(</span><span class="n">proxyHost</span><span class="p">,</span><span class="w"> </span><span class="n">proxyPort</span><span class="p">)</span>
</span><span id="__span-3-13"><a id="__codelineno-3-13" name="__codelineno-3-13" href="#__codelineno-3-13"></a><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">proxy</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Proxy</span><span class="p">(</span><span class="n">Proxy</span><span class="p">.</span><span class="na">Type</span><span class="p">.</span><span class="na">SOCKS</span><span class="p">,</span><span class="w"> </span><span class="n">proxyAddr</span><span class="p">)</span>
</span><span id="__span-3-14"><a id="__codelineno-3-14" name="__codelineno-3-14" href="#__codelineno-3-14"></a>
</span><span id="__span-3-15"><a id="__codelineno-3-15" name="__codelineno-3-15" href="#__codelineno-3-15"></a><span class="w"> </span><span class="n">Authenticator</span><span class="p">.</span><span class="na">setDefault</span><span class="p">(</span><span class="k">object</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="nc">Authenticator</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-16"><a id="__codelineno-3-16" name="__codelineno-3-16" href="#__codelineno-3-16"></a><span class="w"> </span><span class="kd">protected</span><span class="w"> </span><span class="kd">val</span><span class="w"> </span><span class="nv">passwordAuthentication</span><span class="p">:</span><span class="w"> </span><span class="n">PasswordAuthentication?</span>
</span><span id="__span-3-17"><a id="__codelineno-3-17" name="__codelineno-3-17" href="#__codelineno-3-17"></a><span class="w"> </span><span class="n">protected</span><span class="w"> </span><span class="k">get</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-18"><a id="__codelineno-3-18" name="__codelineno-3-18" href="#__codelineno-3-18"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">requestingHost</span><span class="p">.</span><span class="na">lowercase</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">proxyHost</span><span class="p">.</span><span class="na">lowercase</span><span class="p">())</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-19"><a id="__codelineno-3-19" name="__codelineno-3-19" href="#__codelineno-3-19"></a><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">proxyPort</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">requestingPort</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-20"><a id="__codelineno-3-20" name="__codelineno-3-20" href="#__codelineno-3-20"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">PasswordAuthentication</span><span class="p">(</span><span class="n">username</span><span class="p">,</span><span class="w"> </span><span class="n">password</span><span class="p">.</span><span class="na">toCharArray</span><span class="p">())</span>
</span><span id="__span-3-21"><a id="__codelineno-3-21" name="__codelineno-3-21" href="#__codelineno-3-21"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-22"><a id="__codelineno-3-22" name="__codelineno-3-22" href="#__codelineno-3-22"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-23"><a id="__codelineno-3-23" name="__codelineno-3-23" href="#__codelineno-3-23"></a><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="kc">null</span>
</span><span id="__span-3-24"><a id="__codelineno-3-24" name="__codelineno-3-24" href="#__codelineno-3-24"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-25"><a id="__codelineno-3-25" name="__codelineno-3-25" href="#__codelineno-3-25"></a><span class="w"> </span><span class="p">})</span>
</span><span id="__span-3-26"><a id="__codelineno-3-26" name="__codelineno-3-26" href="#__codelineno-3-26"></a><span class="w"> </span><span class="k">this</span><span class="p">.</span><span class="na">client</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">HttpClient</span><span class="p">(</span><span class="n">OkHttp</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-27"><a id="__codelineno-3-27" name="__codelineno-3-27" href="#__codelineno-3-27"></a><span class="w"> </span><span class="n">engine</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-28"><a id="__codelineno-3-28" name="__codelineno-3-28" href="#__codelineno-3-28"></a><span class="w"> </span><span class="n">config</span><span class="w"> </span><span class="p">{</span>
</span><span id="__span-3-29"><a id="__codelineno-3-29" name="__codelineno-3-29" href="#__codelineno-3-29"></a><span class="w"> </span><span class="n">proxy</span><span class="p">(</span><span class="n">proxy</span><span class="p">)</span>
</span><span id="__span-3-30"><a id="__codelineno-3-30" name="__codelineno-3-30" href="#__codelineno-3-30"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-31"><a id="__codelineno-3-31" name="__codelineno-3-31" href="#__codelineno-3-31"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-32"><a id="__codelineno-3-32" name="__codelineno-3-32" href="#__codelineno-3-32"></a><span class="w"> </span><span class="p">}</span>
</span><span id="__span-3-33"><a id="__codelineno-3-33" name="__codelineno-3-33" href="#__codelineno-3-33"></a><span class="p">}</span>
</span></code></pre></div>
<h2 id="next-steps">Next steps<a class="headerlink" href="#next-steps" title="Permanent link">&para;</a></h2>
<ul>
<li><a href="first-bot.html">First bot</a></li>