Update content of files

This commit is contained in:
GitHub Action 2021-05-03 09:37:21 +00:00
parent fb3fe7dbb9
commit e94de27e1c

View file

@ -42,8 +42,7 @@ You may also find the Bot API…">
<h1 id="dev_page_title">Bots FAQ</h1> <h1 id="dev_page_title">Bots FAQ</h1>
<div id="dev_page_content"><blockquote> <div id="dev_page_content"><blockquote>
<p>If you are new to Telegram bots, we recommend checking out our <a href="/bots"><strong>Introduction to Bots</strong></a> first. <p>If you are new to Telegram bots, we recommend checking out our <a href="/bots"><strong>Introduction to Bots</strong></a> first.<br>You may also find the <strong><a href="/bots/api">Bot API Manual</a></strong> useful.</p>
You may also find the <strong><a href="/bots/api">Bot API Manual</a></strong> useful.</p>
</blockquote> </blockquote>
<p><div class="dev_page_nav_wrap"></p> <p><div class="dev_page_nav_wrap"></p>
<p><a href="#general-questions"><strong>General</strong></a></p> <p><a href="#general-questions"><strong>General</strong></a></p>
@ -52,7 +51,7 @@ You may also find the <strong><a href="/bots/api">Bot API Manual</a></strong> us
<li><a href="#i-39m-a-developer-where-can-i-find-some-examples">Where can I get some code examples?</a></li> <li><a href="#i-39m-a-developer-where-can-i-find-some-examples">Where can I get some code examples?</a></li>
<li><a href="#will-you-add-x-to-the-bot-api">I have a feature request!</a></li> <li><a href="#will-you-add-x-to-the-bot-api">I have a feature request!</a></li>
<li><a href="#what-messages-will-my-bot-get">What messages will my bot get?</a></li> <li><a href="#what-messages-will-my-bot-get">What messages will my bot get?</a></li>
<li><a href="#why-doesn-39t-my-bot-see-messages-from-other-bots">Why doesn't my bot see messages from other bots?</a></li> <li><a href="#why-doesn-39t-my-bot-see-messages-from-other-bots">Why doesn&#39;t my bot see messages from other bots?</a></li>
</ul> </ul>
<p><a href="#getting-updates"><strong>Getting Updates</strong></a></p> <p><a href="#getting-updates"><strong>Getting Updates</strong></a></p>
<ul> <ul>
@ -71,29 +70,27 @@ You may also find the <strong><a href="/bots/api">Bot API Manual</a></strong> us
<p><a href="#broadcasting-to-users"><strong>Broadcasting to Users</strong></a></p> <p><a href="#broadcasting-to-users"><strong>Broadcasting to Users</strong></a></p>
<ul> <ul>
<li><a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How do I avoid hitting limits?</a></li> <li><a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How do I avoid hitting limits?</a></li>
<li><a href="#how-can-i-message-all-of-my-bot-39s-subscribers-at-once">How do I message all my subscribers?</a> <li><a href="#how-can-i-message-all-of-my-bot-39s-subscribers-at-once">How do I message all my subscribers?</a><br></div></li>
</div></li>
</ul> </ul>
<hr> <hr>
<h3><a class="anchor" href="#general-questions" id="general-questions"><i class="anchor-icon"></i></a>General Questions</h3> <h3><a class="anchor" name="general-questions" href="#general-questions"><i class="anchor-icon"></i></a>General Questions</h3>
<h4><a class="anchor" href="#how-do-i-create-a-bot" id="how-do-i-create-a-bot"><i class="anchor-icon"></i></a>How do I create a bot?</h4> <h4><a class="anchor" name="how-do-i-create-a-bot" href="#how-do-i-create-a-bot"><i class="anchor-icon"></i></a>How do I create a bot?</h4>
<p>Creating Telegram bots is super-easy, but you will need at least some skills at computer programming. In order for a bot to work, set up a bot account with <a href="https://telegram.me/botfather">@BotFather</a>, then connect it to your backend server via our <a href="/bots/api">API</a>.</p> <p>Creating Telegram bots is super-easy, but you will need at least some skills at computer programming. In order for a bot to work, set up a bot account with <a href="https://telegram.me/botfather">@BotFather</a>, then connect it to your backend server via our <a href="/bots/api">API</a>.</p>
<p>Unfortunately, there are no out-of-the-box ways to create a working bot if you are not a developer. But we're sure you'll soon find plenty of bots created by other people to play with.</p> <p>Unfortunately, there are no out-of-the-box ways to create a working bot if you are not a developer. But we&#39;re sure you&#39;ll soon find plenty of bots created by other people to play with.</p>
<h4><a class="anchor" href="#im-a-developer-where-can-i-find-some-examples" id="im-a-developer-where-can-i-find-some-examples"><i class="anchor-icon"></i></a>I'm a developer. Where can I find some examples?</h4> <h4><a class="anchor" name="i-39m-a-developer-where-can-i-find-some-examples" href="#i-39m-a-developer-where-can-i-find-some-examples"><i class="anchor-icon"></i></a>I&#39;m a developer. Where can I find some examples?</h4>
<p>Here are two sample bots, both written in PHP:</p> <p>Here are two sample bots, both written in PHP:</p>
<ul> <ul>
<li><a href="/bots/samples/hellobot">Hello Bot</a> demonstrates the basics of the Telegram bot API.</li> <li><a href="/bots/samples/hellobot">Hello Bot</a> demonstrates the basics of the Telegram bot API.</li>
<li><a href="https://github.com/kolar/telegram-poll-bot">Simple Poll bot</a> is a more complete example, it supports both long-polling and Webhooks for updates.</li> <li><a href="https://github.com/kolar/telegram-poll-bot">Simple Poll bot</a> is a more complete example, it supports both long-polling and Webhooks for updates.</li>
</ul> </ul>
<blockquote> <blockquote>
<p>Many members of our community are building bots and publishing sources. <p>Many members of our community are building bots and publishing sources.<br>We&#39;re collecting them on <a href="/bots/samples"><strong>this page »</strong></a></p>
We're collecting them on <a href="/bots/samples"><strong>this page »</strong></a></p>
</blockquote> </blockquote>
<p>Ping us on <a href="https://telegram.me/botsupport">@BotSupport</a> if you've built a bot and would like to share it with others.</p> <p>Ping us on <a href="https://telegram.me/botsupport">@BotSupport</a> if you&#39;ve built a bot and would like to share it with others.</p>
<h4><a class="anchor" href="#will-you-add-x-to-the-bot-api" id="will-you-add-x-to-the-bot-api"><i class="anchor-icon"></i></a>Will you add X to the Bot API?</h4> <h4><a class="anchor" name="will-you-add-x-to-the-bot-api" href="#will-you-add-x-to-the-bot-api"><i class="anchor-icon"></i></a>Will you add X to the Bot API?</h4>
<p>The bot API is still pretty young. There are many potential features to consider and implement. We'll be studying what people do with their bots for a while to see which directions will be most important for the platform.</p> <p>The bot API is still pretty young. There are many potential features to consider and implement. We&#39;ll be studying what people do with their bots for a while to see which directions will be most important for the platform.</p>
<p>All bot developers are welcome to share ideas for our Bot API with our <a href="https://telegram.me/botsupport"><strong>@BotSupport</strong></a> account.</p> <p>All bot developers are welcome to share ideas for our Bot API with our <a href="https://telegram.me/botsupport"><strong>@BotSupport</strong></a> account.</p>
<h4><a class="anchor" href="#what-messages-will-my-bot-get" id="what-messages-will-my-bot-get"><i class="anchor-icon"></i></a>What messages will my bot get?</h4> <h4><a class="anchor" name="what-messages-will-my-bot-get" href="#what-messages-will-my-bot-get"><i class="anchor-icon"></i></a>What messages will my bot get?</h4>
<p><strong>1.</strong> <strong>All bots</strong>, regardless of settings, will receive:</p> <p><strong>1.</strong> <strong>All bots</strong>, regardless of settings, will receive:</p>
<ul> <ul>
<li>All service messages.</li> <li>All service messages.</li>
@ -109,17 +106,17 @@ We're collecting them on <a href="/bots/samples"><strong>this page »</strong></
<li>Replies to any messages implicitly or explicitly meant for this bot.</li> <li>Replies to any messages implicitly or explicitly meant for this bot.</li>
</ul> </ul>
<p><strong>Note</strong> that each particular message can only be available to <strong>one</strong> privacy-enabled bot at a time, i.e., a reply to bot A containing an explicit command for bot B or sent via bot C will only be available to bot A. Replies have the highest priority.</p> <p><strong>Note</strong> that each particular message can only be available to <strong>one</strong> privacy-enabled bot at a time, i.e., a reply to bot A containing an explicit command for bot B or sent via bot C will only be available to bot A. Replies have the highest priority.</p>
<h4><a class="anchor" href="#why-doesnt-my-bot-see-messages-from-other-bots" id="why-doesnt-my-bot-see-messages-from-other-bots"><i class="anchor-icon"></i></a>Why doesn't my bot see messages from other bots?</h4> <h4><a class="anchor" name="why-doesn-39t-my-bot-see-messages-from-other-bots" href="#why-doesn-39t-my-bot-see-messages-from-other-bots"><i class="anchor-icon"></i></a>Why doesn&#39;t my bot see messages from other bots?</h4>
<p>Bots talking to each other could potentially get stuck in unwelcome loops. To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.</p> <p>Bots talking to each other could potentially get stuck in unwelcome loops. To avoid this, we decided that bots will not be able to see messages from other bots regardless of mode.</p>
<h3><a class="anchor" href="#getting-updates" id="getting-updates"><i class="anchor-icon"></i></a>Getting Updates</h3> <h3><a class="anchor" name="getting-updates" href="#getting-updates"><i class="anchor-icon"></i></a>Getting Updates</h3>
<h4><a class="anchor" href="#how-do-i-get-updates" id="how-do-i-get-updates"><i class="anchor-icon"></i></a>How do I get updates?</h4> <h4><a class="anchor" name="how-do-i-get-updates" href="#how-do-i-get-updates"><i class="anchor-icon"></i></a>How do I get updates?</h4>
<p>There are currently two ways of getting updates. You can either use <a href="https://core.telegram.org/bots/api#getupdates">long polling</a> or <a href="https://core.telegram.org/bots/api#setwebhook">Webhooks</a>. Please note that it's <strong>not</strong> possible to get updates via long polling while an outgoing Webhook is set.</p> <p>There are currently two ways of getting updates. You can either use <a href="https://core.telegram.org/bots/api#getupdates">long polling</a> or <a href="https://core.telegram.org/bots/api#setwebhook">Webhooks</a>. Please note that it&#39;s <strong>not</strong> possible to get updates via long polling while an outgoing Webhook is set.</p>
<h4><a class="anchor" href="#long-polling-gives-me-the-same-updates-again-and-again" id="long-polling-gives-me-the-same-updates-again-and-again"><i class="anchor-icon"></i></a>Long polling gives me the same updates again and again!</h4> <h4><a class="anchor" name="long-polling-gives-me-the-same-updates-again-and-again" href="#long-polling-gives-me-the-same-updates-again-and-again"><i class="anchor-icon"></i></a>Long polling gives me the same updates again and again!</h4>
<p>The <a href="/bots/api#getupdates">getUpdates</a> method returns the earliest 100 unconfirmed updates. To confirm an update, use the <em>offset</em> parameter when calling getUpdates like this:</p> <p>The <a href="/bots/api#getupdates">getUpdates</a> method returns the earliest 100 unconfirmed updates. To confirm an update, use the <em>offset</em> parameter when calling getUpdates like this:</p>
<pre><code>offset = update_id of last processed update + 1</code></pre> <pre><code>offset = update_id of last processed update + 1</code></pre>
<p>All updates with <em>update_id</em> less than or equal to <em>offset</em> will be marked as confirmed on the server and will no longer be returned.</p> <p>All updates with <em>update_id</em> less than or equal to <em>offset</em> will be marked as confirmed on the server and will no longer be returned.</p>
<h4><a class="anchor" href="#im-having-problems-with-webhooks" id="im-having-problems-with-webhooks"><i class="anchor-icon"></i></a>I'm having problems with Webhooks.</h4> <h4><a class="anchor" name="i-39m-having-problems-with-webhooks" href="#i-39m-having-problems-with-webhooks"><i class="anchor-icon"></i></a>I&#39;m having problems with Webhooks.</h4>
<p>If you've set up your webhook successfully, but are not getting any updates, please remember:</p> <p>If you&#39;ve set up your webhook successfully, but are not getting any updates, please remember:</p>
<ul> <ul>
<li>You need a valid SSL certificate for webhooks to work.</li> <li>You need a valid SSL certificate for webhooks to work.</li>
<li>To use a self-signed certificate, you need to upload your public key certificate using the <em>certificate</em> parameter in <a href="/bots/api#setwebhook">setWebhook</a>. Please upload as InputFile, sending a String will not work.</li> <li>To use a self-signed certificate, you need to upload your public key certificate using the <em>certificate</em> parameter in <a href="/bots/api#setwebhook">setWebhook</a>. Please upload as InputFile, sending a String will not work.</li>
@ -131,44 +128,46 @@ We're collecting them on <a href="/bots/samples"><strong>this page »</strong></
<blockquote> <blockquote>
<p>Please check out this new <a href="/bots/webhooks"><strong>WEBHOOK GUIDE</strong></a> to learn all there is to know about webhooks!</p> <p>Please check out this new <a href="/bots/webhooks"><strong>WEBHOOK GUIDE</strong></a> to learn all there is to know about webhooks!</p>
</blockquote> </blockquote>
<h4><a class="anchor" href="#im-having-trouble-with-my-self-signed-certificate" id="im-having-trouble-with-my-self-signed-certificate"><i class="anchor-icon"></i></a>I'm having trouble with my self-signed certificate!</h4> <h4><a class="anchor" name="i-39m-having-trouble-with-my-self-signed-certificate" href="#i-39m-having-trouble-with-my-self-signed-certificate"><i class="anchor-icon"></i></a>I&#39;m having trouble with my self-signed certificate!</h4>
<p>Please take a look at this <a href="/bots/self-signed">self-signed certificate guide</a> we made just for you. If you've read it and still have a question, ping us on botsupport.</p> <p>Please take a look at this <a href="/bots/self-signed">self-signed certificate guide</a> we made just for you. If you&#39;ve read it and still have a question, ping us on botsupport.</p>
<h4><a class="anchor" href="#how-can-i-make-sure-that-webhook-requests-are-coming-from-telegram" id="how-can-i-make-sure-that-webhook-requests-are-coming-from-telegram"><i class="anchor-icon"></i></a>How can I make sure that Webhook requests are coming from Telegram?</h4> <h4><a class="anchor" name="how-can-i-make-sure-that-webhook-requests-are-coming-from-telegr" href="#how-can-i-make-sure-that-webhook-requests-are-coming-from-telegr"><i class="anchor-icon"></i></a>How can I make sure that Webhook requests are coming from Telegram?</h4>
<p>If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL you give us, e.g. www.example.com/your_token. Since nobody else knows your bot's token, you can be pretty sure it's us.</p> <p>If you&#39;d like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL you give us, e.g. www.example.com/your_token. Since nobody else knows your bot&#39;s token, you can be pretty sure it&#39;s us.</p>
<h4><a class="anchor" href="#how-can-i-make-requests-in-response-to-updates" id="how-can-i-make-requests-in-response-to-updates"><i class="anchor-icon"></i></a>How can I make requests in response to updates?</h4> <h4><a class="anchor" name="how-can-i-make-requests-in-response-to-updates" href="#how-can-i-make-requests-in-response-to-updates"><i class="anchor-icon"></i></a>How can I make requests in response to updates?</h4>
<p>This is possible if you're using webhooks. The upside is that you need less requests, the downside — that in this case it's not possible to know that such a request was successful or get its result. </p> <p>This is possible if you&#39;re using webhooks. The upside is that you need less requests, the downside — that in this case it&#39;s not possible to know that such a request was successful or get its result. </p>
<p>Whenever you receive a webhook update, you have two options:</p> <p>Whenever you receive a webhook update, you have two options:</p>
<p><strong>1. Issue POST to <a href="https://api.telegram.org/bot&amp;lt;token&amp;gt;/method">https://api.telegram.org/bot&amp;lt;token&amp;gt;/method</a></strong></p> <p><strong>1. Issue POST to https://api.telegram.org/bot&lt;token&gt;/method</strong></p>
<div> <div>
<a href="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" target="_blank"><img src="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" title="Confirm and request" class="dev_page_image" style="width:500px;"></a> <a href="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" target="_blank"><img src="/file/811140979/3/5p52TWl9X2o/5c6d684ee0d6a4399d" title="Confirm and request" class="dev_page_image" style="width:500px;" /></a>
</div> </div>
<p><strong>2. Reply directly and give method as JSON payload in the reply</strong></p> <p><strong>2. Reply directly and give method as JSON payload in the reply</strong></p>
<div> <div>
<a href="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" target="_blank"><img src="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" title="Reply with payload" class="dev_page_image" style="width:500px;"></a></div> <a href="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" target="_blank"><img src="/file/811140266/2/vGxiVmENAos/6cffad00cbe72be7f2" title="Reply with payload" class="dev_page_image" style="width:500px;" /></a></div>
<blockquote> <blockquote>
<p>You may also want to look at our sample <a href="/bots/samples/hellobot">HelloBot</a>, it offers a PHP implementation of this.</p> <p>You may also want to look at our sample <a href="/bots/samples/hellobot">HelloBot</a>, it offers a PHP implementation of this.</p>
</blockquote> </blockquote>
<h3><a class="anchor" href="#handling-media" id="handling-media"><i class="anchor-icon"></i></a>Handling Media</h3> <h3><a class="anchor" name="handling-media" href="#handling-media"><i class="anchor-icon"></i></a>Handling Media</h3>
<h4><a class="anchor" href="#how-do-i-download-files" id="how-do-i-download-files"><i class="anchor-icon"></i></a>How do I download files?</h4> <h4><a class="anchor" name="how-do-i-download-files" href="#how-do-i-download-files"><i class="anchor-icon"></i></a>How do I download files?</h4>
<p>Use the <a href="/bots/api#getfile">getFile</a> method. Please note that this will only work with files of up to 20 MB in size.</p> <p>Use the <a href="/bots/api#getfile">getFile</a> method. Please note that this will only work with files of up to 20 MB in size.</p>
<h4><a class="anchor" href="#how-do-i-upload-a-large-file" id="how-do-i-upload-a-large-file"><i class="anchor-icon"></i></a>How do I upload a large file?</h4> <h4><a class="anchor" name="how-do-i-upload-a-large-file" href="#how-do-i-upload-a-large-file"><i class="anchor-icon"></i></a>How do I upload a large file?</h4>
<p>Bots can currently send files of any type of up to 50 MB in size, so yes, very large files won't work for now. Sorry. This limit may be changed in the future.</p> <p>Bots can currently send files of any type of up to 50 MB in size, so yes, very large files won&#39;t work for now. Sorry. This limit may be changed in the future.</p>
<h4><a class="anchor" href="#can-i-count-on-file-ids-to-be-persistent" id="can-i-count-on-file-ids-to-be-persistent"><i class="anchor-icon"></i></a>Can I count on file_ids to be persistent?</h4> <h4><a class="anchor" name="can-i-count-on-file-ids-to-be-persistent" href="#can-i-count-on-file-ids-to-be-persistent"><i class="anchor-icon"></i></a>Can I count on file_ids to be persistent?</h4>
<p>Yes, file_ids can be treated as persistent.</p> <p>Yes, file_ids can be treated as persistent.</p>
<h3><a class="anchor" href="#broadcasting-to-users" id="broadcasting-to-users"><i class="anchor-icon"></i></a>Broadcasting to Users</h3> <h3><a class="anchor" name="broadcasting-to-users" href="#broadcasting-to-users"><i class="anchor-icon"></i></a>Broadcasting to Users</h3>
<h4><a class="anchor" href="#my-bot-is-hitting-limits-how-do-i-avoid-this" id="my-bot-is-hitting-limits-how-do-i-avoid-this"><i class="anchor-icon"></i></a>My bot is hitting limits, how do I avoid this?</h4> <h4><a class="anchor" name="my-bot-is-hitting-limits-how-do-i-avoid-this" href="#my-bot-is-hitting-limits-how-do-i-avoid-this"><i class="anchor-icon"></i></a>My bot is hitting limits, how do I avoid this?</h4>
<p>When sending messages inside a particular chat, avoid sending more than one message per second. We may allow short bursts that go over this limit, but eventually you'll begin receiving 429 errors.</p> <p>When sending messages inside a particular chat, avoid sending more than one message per second. We may allow short bursts that go over this limit, but eventually you&#39;ll begin receiving 429 errors.</p>
<p>If you're sending bulk notifications to multiple users, the API will not allow more than 30 messages per second or so. Consider spreading out notifications over large intervals of 8—12 hours for best results.</p> <p>If you&#39;re sending bulk notifications to multiple users, the API will not allow more than 30 messages per second or so. Consider spreading out notifications over large intervals of 8—12 hours for best results.</p>
<p>Also note that your bot will not be able to send more than 20 messages per minute to the same group.</p> <p>Also note that your bot will not be able to send more than 20 messages per minute to the same group.</p>
<h4><a class="anchor" href="#how-can-i-message-all-of-my-bots-subscribers-at-once" id="how-can-i-message-all-of-my-bots-subscribers-at-once"><i class="anchor-icon"></i></a>How can I message all of my bot's subscribers at once?</h4> <h4><a class="anchor" name="how-can-i-message-all-of-my-bot-39s-subscribers-at-once" href="#how-can-i-message-all-of-my-bot-39s-subscribers-at-once"><i class="anchor-icon"></i></a>How can I message all of my bot&#39;s subscribers at once?</h4>
<p>Unfortunately, at this moment we don't have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future.</p> <p>Unfortunately, at this moment we don&#39;t have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future.</p>
<p>In order to avoid hitting our limits when sending out mass notifications, consider spreading them over longer intervals, e.g. 8-12 hours. The API will not allow bulk notifications to more than ~30 users per second, if you go over that, you'll start getting 429 errors.</p> <p>In order to avoid hitting our limits when sending out mass notifications, consider spreading them over longer intervals, e.g. 8-12 hours. The API will not allow bulk notifications to more than ~30 users per second, if you go over that, you&#39;ll start getting 429 errors.</p>
<p>See also: <a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How to avoid hitting limits?</a></p> <p>See also: <a href="#my-bot-is-hitting-limits-how-do-i-avoid-this">How to avoid hitting limits?</a></p>
<hr> <hr>
<blockquote> <blockquote>
<p>If you've got questions that are not answered on this page, ping us at <a href="https://telegram.me/botsupport">@BotSupport</a> in Telegram. <p>If you&#39;ve got questions that are not answered on this page, ping us at <a href="https://telegram.me/botsupport">@BotSupport</a> in Telegram.<br>We welcome any suggestions for the Bot Platform and API.</p>
We welcome any suggestions for the Bot Platform and API.</p> </blockquote>
</blockquote></div> </div>
</div> </div>