Skip to content

Commit

Permalink
deploy: a05fa2a
Browse files Browse the repository at this point in the history
  • Loading branch information
visciang committed Oct 21, 2024
1 parent 3ecfd63 commit 0e17a52
Show file tree
Hide file tree
Showing 20 changed files with 519 additions and 197 deletions.
5 changes: 3 additions & 2 deletions .build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Telegram.Api.html
Telegram.Bot.Dispatch.html
Telegram.Bot.Utils.html
Telegram.Bot.html
Telegram.ChatBot.Chat.html
Telegram.ChatBot.html
Telegram.Poller.html
Telegram.Types.html
Expand All @@ -27,8 +28,8 @@ dist/lato-latin-ext-300-normal-VPGGJKJL.woff2
dist/lato-latin-ext-400-normal-N27NCBWW.woff2
dist/lato-latin-ext-700-normal-Q2L5DVMW.woff2
dist/remixicon-NKANDIL5.woff2
dist/search_data-4920CCA6.js
dist/sidebar_items-8D15BDBE.js
dist/search_data-04406780.js
dist/sidebar_items-2BBF389D.js
index.html
readme.html
search.html
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-K7URE6B4.js"></script>
<script src="dist/sidebar_items-8D15BDBE.js"></script>
<script src="dist/sidebar_items-2BBF389D.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-YIPIRHGU.js"></script>

Expand Down
12 changes: 6 additions & 6 deletions Telegram.Api.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-K7URE6B4.js"></script>
<script src="dist/sidebar_items-8D15BDBE.js"></script>
<script src="dist/sidebar_items-2BBF389D.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-YIPIRHGU.js"></script>

Expand Down Expand Up @@ -369,15 +369,15 @@ <h1 class="signature" translate="no">file(token, file_path)</h1>
</div>

<p>Download a file.</p><p>Reference: <a href="https://core.telegram.org/bots/api#file">BOT Api</a></p><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="c1"># send a photo</span><span class="w">
</span><span class="p" data-group-id="5329201815-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">res</span><span class="p" data-group-id="5329201815-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="5329201815-2">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;sendPhoto&quot;</span><span class="p">,</span><span class="w"> </span><span class="ss">chat_id</span><span class="p">:</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">photo</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5329201815-3">{</span><span class="ss">:file</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;example/photo.jpg&quot;</span><span class="p" data-group-id="5329201815-3">}</span><span class="p" data-group-id="5329201815-2">)</span><span class="w">
</span><span class="p" data-group-id="0366004958-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">res</span><span class="p" data-group-id="0366004958-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="0366004958-2">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;sendPhoto&quot;</span><span class="p">,</span><span class="w"> </span><span class="ss">chat_id</span><span class="p">:</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">photo</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0366004958-3">{</span><span class="ss">:file</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;example/photo.jpg&quot;</span><span class="p" data-group-id="0366004958-3">}</span><span class="p" data-group-id="0366004958-2">)</span><span class="w">
</span><span class="c1"># pick the &#39;file_obj&#39; with the desired resolution</span><span class="w">
</span><span class="p" data-group-id="5329201815-4">[</span><span class="n">file_obj</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="bp">_</span><span class="p" data-group-id="5329201815-4">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">res</span><span class="p" data-group-id="5329201815-5">[</span><span class="s">&quot;photo&quot;</span><span class="p" data-group-id="5329201815-5">]</span><span class="w">
</span><span class="p" data-group-id="0366004958-4">[</span><span class="n">file_obj</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="bp">_</span><span class="p" data-group-id="0366004958-4">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">res</span><span class="p" data-group-id="0366004958-5">[</span><span class="s">&quot;photo&quot;</span><span class="p" data-group-id="0366004958-5">]</span><span class="w">
</span><span class="c1"># get the &#39;file_id&#39;</span><span class="w">
</span><span class="n">file_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">file_obj</span><span class="p" data-group-id="5329201815-6">[</span><span class="s">&quot;file_id&quot;</span><span class="p" data-group-id="5329201815-6">]</span><span class="w">
</span><span class="n">file_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">file_obj</span><span class="p" data-group-id="0366004958-6">[</span><span class="s">&quot;file_id&quot;</span><span class="p" data-group-id="0366004958-6">]</span><span class="w">

</span><span class="c1"># obtain the &#39;file_path&#39; to download the file identified by &#39;file_id&#39;</span><span class="w">
</span><span class="p" data-group-id="5329201815-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5329201815-8">%{</span><span class="s">&quot;file_path&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">file_path</span><span class="p" data-group-id="5329201815-8">}</span><span class="p" data-group-id="5329201815-7">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="5329201815-9">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;getFile&quot;</span><span class="p">,</span><span class="w"> </span><span class="ss">file_id</span><span class="p">:</span><span class="w"> </span><span class="n">file_id</span><span class="p" data-group-id="5329201815-9">)</span><span class="w">
</span><span class="p" data-group-id="5329201815-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">file</span><span class="p" data-group-id="5329201815-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">file</span><span class="p" data-group-id="5329201815-11">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="n">file_path</span><span class="p" data-group-id="5329201815-11">)</span></code></pre>
</span><span class="p" data-group-id="0366004958-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0366004958-8">%{</span><span class="s">&quot;file_path&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">file_path</span><span class="p" data-group-id="0366004958-8">}</span><span class="p" data-group-id="0366004958-7">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="0366004958-9">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;getFile&quot;</span><span class="p">,</span><span class="w"> </span><span class="ss">file_id</span><span class="p">:</span><span class="w"> </span><span class="n">file_id</span><span class="p" data-group-id="0366004958-9">)</span><span class="w">
</span><span class="p" data-group-id="0366004958-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">file</span><span class="p" data-group-id="0366004958-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">file</span><span class="p" data-group-id="0366004958-11">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="n">file_path</span><span class="p" data-group-id="0366004958-11">)</span></code></pre>
</section>
</section>
<section class="detail" id="request/3">
Expand Down
2 changes: 1 addition & 1 deletion Telegram.Bot.Dispatch.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-K7URE6B4.js"></script>
<script src="dist/sidebar_items-8D15BDBE.js"></script>
<script src="dist/sidebar_items-2BBF389D.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-YIPIRHGU.js"></script>

Expand Down
40 changes: 1 addition & 39 deletions Telegram.Bot.Utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-K7URE6B4.js"></script>
<script src="dist/sidebar_items-8D15BDBE.js"></script>
<script src="dist/sidebar_items-2BBF389D.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-YIPIRHGU.js"></script>

Expand Down Expand Up @@ -141,16 +141,6 @@ <h2>
<a href="#functions">Functions</a>
</h2>

<div class="summary-row">
<div class="summary-signature">
<a href="#get_chat/1" data-no-tooltip translate="no">get_chat(update)</a>

</div>

<div class="summary-synopsis"><p>Get the &quot;chat&quot; field in an Update object, if present</p></div>

</div>

<div class="summary-row">
<div class="summary-signature">
<a href="#get_from_username/1" data-no-tooltip translate="no">get_from_username(update)</a>
Expand Down Expand Up @@ -195,34 +185,6 @@ <h1 class="section-heading">
<span class="text">Functions</span>
</h1>
<div class="functions-list">
<section class="detail" id="get_chat/1">

<div class="detail-header">
<a href="#get_chat/1" class="detail-link" data-no-tooltip title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">get_chat(update)</h1>

<a href="https://github.com/visciang/telegram/blob/main/lib/bot/utils.ex#L60" class="icon-action" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>


</div>

<section class="docstring">

<div class="specs">

<pre translate="no"><span class="attribute">@spec</span> get_chat(<a href="Telegram.Types.html#t:update/0">Telegram.Types.update</a>()) :: {:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">map</a>()} | nil</pre>

</div>

<p>Get the &quot;chat&quot; field in an Update object, if present</p>
</section>
</section>
<section class="detail" id="get_from_username/1">

<div class="detail-header">
Expand Down
24 changes: 12 additions & 12 deletions Telegram.Bot.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
<script src="dist/handlebars.templates-K7URE6B4.js"></script>
<script src="dist/sidebar_items-8D15BDBE.js"></script>
<script src="dist/sidebar_items-2BBF389D.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/html-YIPIRHGU.js"></script>

Expand Down Expand Up @@ -130,27 +130,27 @@ <h1>
</a>
<span class="text">Example</span>
</h2>
<pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">HelloBot</span><span class="w"> </span><span class="k" data-group-id="8127077347-1">do</span><span class="w">
<pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">HelloBot</span><span class="w"> </span><span class="k" data-group-id="8632829754-1">do</span><span class="w">
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Telegram.Bot</span><span class="w">

</span><span class="na">@impl</span><span class="w"> </span><span class="nc">Telegram.Bot</span><span class="w">
</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_update</span><span class="p" data-group-id="8127077347-2">(</span><span class="w">
</span><span class="p" data-group-id="8127077347-3">%{</span><span class="s">&quot;message&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p" data-group-id="8127077347-4">%{</span><span class="s">&quot;text&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="s">&quot;/hello&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;chat&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p" data-group-id="8127077347-5">%{</span><span class="s">&quot;id&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">chat_id</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;username&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">username</span><span class="p" data-group-id="8127077347-5">}</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;message_id&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">message_id</span><span class="p" data-group-id="8127077347-4">}</span><span class="p" data-group-id="8127077347-3">}</span><span class="p">,</span><span class="w">
</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_update</span><span class="p" data-group-id="8632829754-2">(</span><span class="w">
</span><span class="p" data-group-id="8632829754-3">%{</span><span class="s">&quot;message&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p" data-group-id="8632829754-4">%{</span><span class="s">&quot;text&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="s">&quot;/hello&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;chat&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="p" data-group-id="8632829754-5">%{</span><span class="s">&quot;id&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">chat_id</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;username&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">username</span><span class="p" data-group-id="8632829754-5">}</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;message_id&quot;</span><span class="w"> </span><span class="p">=&gt;</span><span class="w"> </span><span class="n">message_id</span><span class="p" data-group-id="8632829754-4">}</span><span class="p" data-group-id="8632829754-3">}</span><span class="p">,</span><span class="w">
</span><span class="n">token</span><span class="w">
</span><span class="p" data-group-id="8127077347-2">)</span><span class="w"> </span><span class="k" data-group-id="8127077347-6">do</span><span class="w">
</span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="8127077347-7">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;sendMessage&quot;</span><span class="p">,</span><span class="w">
</span><span class="p" data-group-id="8632829754-2">)</span><span class="w"> </span><span class="k" data-group-id="8632829754-6">do</span><span class="w">
</span><span class="nc">Telegram.Api</span><span class="o">.</span><span class="n">request</span><span class="p" data-group-id="8632829754-7">(</span><span class="n">token</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;sendMessage&quot;</span><span class="p">,</span><span class="w">
</span><span class="ss">chat_id</span><span class="p">:</span><span class="w"> </span><span class="n">chat_id</span><span class="p">,</span><span class="w">
</span><span class="ss">reply_to_message_id</span><span class="p">:</span><span class="w"> </span><span class="n">message_id</span><span class="p">,</span><span class="w">
</span><span class="ss">text</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;Hello </span><span class="si" data-group-id="8127077347-8">#{</span><span class="n">username</span><span class="si" data-group-id="8127077347-8">}</span><span class="s">!&quot;</span><span class="w">
</span><span class="p" data-group-id="8127077347-7">)</span><span class="w">
</span><span class="k" data-group-id="8127077347-6">end</span><span class="w">
</span><span class="ss">text</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;Hello </span><span class="si" data-group-id="8632829754-8">#{</span><span class="n">username</span><span class="si" data-group-id="8632829754-8">}</span><span class="s">!&quot;</span><span class="w">
</span><span class="p" data-group-id="8632829754-7">)</span><span class="w">
</span><span class="k" data-group-id="8632829754-6">end</span><span class="w">

</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_update</span><span class="p" data-group-id="8127077347-9">(</span><span class="c">_update</span><span class="p">,</span><span class="w"> </span><span class="c">_token</span><span class="p" data-group-id="8127077347-9">)</span><span class="w"> </span><span class="k" data-group-id="8127077347-10">do</span><span class="w">
</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_update</span><span class="p" data-group-id="8632829754-9">(</span><span class="c">_update</span><span class="p">,</span><span class="w"> </span><span class="c">_token</span><span class="p" data-group-id="8632829754-9">)</span><span class="w"> </span><span class="k" data-group-id="8632829754-10">do</span><span class="w">
</span><span class="c1"># ignore unknown updates</span><span class="w">

</span><span class="ss">:ok</span><span class="w">
</span><span class="k" data-group-id="8127077347-10">end</span><span class="w">
</span><span class="k" data-group-id="8127077347-1">end</span></code></pre>
</span><span class="k" data-group-id="8632829754-10">end</span><span class="w">
</span><span class="k" data-group-id="8632829754-1">end</span></code></pre>
</section>

</div>
Expand Down
Loading

0 comments on commit 0e17a52

Please sign in to comment.