Update content of files

This commit is contained in:
GitHub Action 2023-11-30 23:10:30 +00:00
parent d3538016c4
commit d2d6ba4b2d
3 changed files with 144 additions and 5 deletions

View file

@ -89,12 +89,39 @@ Note that eventual errors will not be sent as a <code>failed</code> event if the
<h4><a class="anchor" href="#theme-changed" id="theme-changed" name="theme-changed"><i class="anchor-icon"></i></a><code>theme_changed</code></h4>
<p>Params: a JSON object with the following fields:</p>
<ul>
<li><code>theme_params</code>: A <a href="#theme-parameters">theme parameters object »</a> (object)</li>
<li><code>theme_params</code> - A <a href="#theme-parameters">theme parameters object »</a> (object)</li>
</ul>
<p>Emitted when requested by the Mini App using a <a href="/api/web-events#web-app-request-theme"><code>web_app_request_theme</code> event »</a>, or when the app theme changes. </p>
<h4><a class="anchor" href="#popup-closed" id="popup-closed" name="popup-closed"><i class="anchor-icon"></i></a><code>popup_closed</code></h4>
<p>Params: a JSON object with an optional <code>button_id</code> string field.</p>
<p>Emitted when the user presses a button or cancels a popup brought up by a previous <a href="/api/web-events#web-app-open-popup"><code>web_app_open_popup</code> event »</a>. </p>
<h4><a class="anchor" href="#write-access-requested" id="write-access-requested" name="write-access-requested"><i class="anchor-icon"></i></a><code>write_access_requested</code></h4>
<p>Params: a JSON object with the following fields:</p>
<ul>
<li><code>status</code> - <code>allowed</code> or <code>cancelled</code></li>
</ul>
<p>Used by clients to reply to a <a href="/api/web-events#web-app-request-write-access"><code>web_app_request_write_access</code> event »</a>, indicating whether the user has allowed the bot to send messages to the user (<code>allowed</code>) or not (<code>cancelled</code>). </p>
<h4><a class="anchor" href="#phone-requested" id="phone-requested" name="phone-requested"><i class="anchor-icon"></i></a><code>phone_requested</code></h4>
<p>Params: a JSON object with the following fields:</p>
<ul>
<li><code>status</code> - <code>sent</code> or <code>cancelled</code></li>
</ul>
<p>Used by clients to reply to a <a href="/api/web-events#web-app-request-phone"><code>web_app_request_phone</code> event »</a>, indicating whether the user has shared their phone number with the bot (<code>allowed</code>) or not (<code>cancelled</code>). </p>
<h4><a class="anchor" href="#custom-method-invoked" id="custom-method-invoked" name="custom-method-invoked"><i class="anchor-icon"></i></a><code>custom_method_invoked</code></h4>
<p>Params: a JSON object with the following fields:</p>
<ul>
<li><code>req_id</code> - The <code>req_id</code> from the <code>web_app_invoke_custom_method</code> request</li>
<li><code>result</code> - The JSON data contained in the response of the <a href="/method/bots.invokeWebViewCustomMethod">bots.invokeWebViewCustomMethod</a> method, if the method call succeeded</li>
<li><code>error</code> - The text of the RPC error, if the method call failed</li>
</ul>
<p>Used by clients to reply to <a href="/api/web-events#web-app-invoke-custom-method"><code>web_app_invoke_custom_method</code> events »</a>. </p>
<h4><a class="anchor" href="#clipboard-text-received" id="clipboard-text-received" name="clipboard-text-received"><i class="anchor-icon"></i></a><code>clipboard_text_received</code></h4>
<p>Params: a JSON object with the following fields:</p>
<ul>
<li><code>req_id</code> - The <code>req_id</code> from the <code>web_app_read_text_from_clipboard</code> request</li>
<li><code>data</code> - A string with the clipboard contents (optional, if not provided consider the request failed)</li>
</ul>
<p>Used by clients to reply to <a href="/api/web-events#web-app-read-text-from-clipboard"><code>web_app_read_text_from_clipboard</code> events »</a>. </p>
<h3><a class="anchor" href="#keyboard-button-mini-apps" id="keyboard-button-mini-apps" name="keyboard-button-mini-apps"><i class="anchor-icon"></i></a>Keyboard Button Mini Apps</h3>
<p>Schema:</p>
<pre><code><a href='/constructor/replyKeyboardMarkup'>replyKeyboardMarkup</a>#85dd99d1 flags:<a href='/type/%23'>#</a> resize:flags.0?<a href='/constructor/true'>true</a> single_use:flags.1?<a href='/constructor/true'>true</a> selective:flags.2?<a href='/constructor/true'>true</a> persistent:flags.4?<a href='/constructor/true'>true</a> rows:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/KeyboardButtonRow'>KeyboardButtonRow</a>&gt; placeholder:flags.3?<a href='/type/string'>string</a> = <a href='/type/ReplyMarkup'>ReplyMarkup</a>;
@ -253,7 +280,6 @@ Confirmation should <strong>always</strong> be asked, even if the <code>inactive
</li>
</ul>
<p>Finally, open the webview using the <code>url</code> contained in the returned <a href="/constructor/appWebViewResultUrl">appWebViewResultUrl</a>. </p>
<p>The bot can write to the user directly if it already has a chat with the user or if it requested permission via <code>request_write_access</code> and the user granted it with <code>write_allowed</code>. </p>
<h3><a class="anchor" href="#theme-parameters" id="theme-parameters" name="theme-parameters"><i class="anchor-icon"></i></a>Theme parameters</h3>
<p>Bot Mini Apps can be themed according to the following theme parameters, passed as a JSON object to the <code>theme_params</code> parameter of the <a href="/method/messages.requestSimpleWebView">messages.requestSimpleWebView</a> and <a href="/method/messages.requestWebView">messages.requestWebView</a> methods. </p>
<p>This JSON object has the following keys, containing color theme information (hex string, RGB, no alpha) to pass to the Mini App:</p>

View file

@ -76,7 +76,7 @@ The GamingCommunication and bot mini apps libraries by default will use <code>'*
</ul>
</li>
</ul>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> when to open a native pop-up over the webview.</p>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> to open a native pop-up over the webview.</p>
<p>By default, buttons should be displayed on one row.<br>
If the mini app provides two buttons that can't fit horizontally on one row, display each button on a separate row.<br>
If the mini app provides three buttons, always display each button on a separate row. </p>
@ -86,6 +86,50 @@ If the mini app provides three buttons, always display each button on a separate
</ul>
<p>Disable handling of this event if a popup is already being displayed, re-enable handling only after the <code>popup_closed</code> response event is emitted.<br>
While handling is enabled, maximum 3 consecutive valid events of this type can be handled in a timespan of 3 seconds, ignore excess events. </p>
<h4><a class="anchor" href="#web-app-request-write-access" id="web-app-request-write-access" name="web-app-request-write-access"><i class="anchor-icon"></i></a><code>web_app_request_write_access</code></h4>
<p>Event data: <code>null</code></p>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> to ask permission from the user to send them messages. </p>
<p>Upon receiving this event, clients should first invoke <a href="/method/bots.canSendMessage">bots.canSendMessage</a>, to check whether they have already granted the bot permission to write them in some way. </p>
<ul>
<li>If the method returns <a href="/constructor/boolTrue">boolTrue</a>, a <a href="/api/bots/webapps#write-access-requested">write_access_requested event »</a> with <code>{"status": "allowed"}</code> should be sent to the Mini App.</li>
<li>Otherwise, if the method returns <a href="/constructor/boolFalse">boolFalse</a>, a prompt should be shown to the user, indicating that the bot is asking permission to send messages to them.<br>
If the user accepts, invoke <a href="/method/bots.allowSendMessage">bots.allowSendMessage</a>, and if the method call succeeds emit a <a href="/api/bots/webapps#write-access-requested">write_access_requested event »</a> with <code>{"status": "allowed"}</code>.<br>
Otherwise, if the user refuses or the <a href="/method/bots.allowSendMessage">bots.allowSendMessage</a> call fails, emit a <a href="/api/bots/webapps#write-access-requested">write_access_requested event »</a> with <code>{"status": "cancelled"}</code>.</li>
</ul>
<h4><a class="anchor" href="#web-app-request-phone" id="web-app-request-phone" name="web-app-request-phone"><i class="anchor-icon"></i></a><code>web_app_request_phone</code></h4>
<p>Event data: <code>null</code></p>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> to ask the user to share their phone number as a contact.</p>
<p>Upon receiving this event, clients should show a prompt to the user, indicating that the bot is asking them to share their phone number (optionally also asking the user to unblock the bot, if it's currently blocked). </p>
<p>If they accept, the user's phone number should be shared by sending a contact to the bot (unblocking it first, if it's currently blocked by the user); if all RPC queries (to unblock the bot, to send the message) succeed, a <a href="/api/bots/webapps#write-access-requested">phone_requested event »</a> should be sent with <code>{"status": "sent"}</code>. </p>
<p>If the user refuses or any intermdiate method call fails, a <a href="/api/bots/webapps#write-access-requested">phone_requested event »</a> should be sent with <code>{"status": "cancelled"}</code>. </p>
<h4><a class="anchor" href="#web-app-invoke-custom-method" id="web-app-invoke-custom-method" name="web-app-invoke-custom-method"><i class="anchor-icon"></i></a><code>web_app_invoke_custom_method</code></h4>
<p>Event data: a JSON object with the following fields:</p>
<ul>
<li><code>req_id</code> - A string with the ID of the current request</li>
<li><code>method</code> - A string, containing the name of the called custom method</li>
<li><code>params</code> - An object containing the parameters of the method call</li>
</ul>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> to make custom method calls to Telegram's servers on behalf of the user. </p>
<p>This event should trigger a <a href="/method/bots.invokeWebViewCustomMethod">bots.invokeWebViewCustomMethod</a> request, passing the <code>method</code> to <code>custom_method</code>, and the <code>params</code> to <code>params</code>. </p>
<p>Upon receiving a reply, a <a href="/api/bots/webapps#custom-method-invoked">custom_method_invoked event »</a> should be emitted, with the following fields:</p>
<ul>
<li><code>req_id</code> - The <code>req_id</code> from the <code>web_app_invoke_custom_method</code> object</li>
<li><code>result</code> - The JSON data contained in the response of the <a href="/method/bots.invokeWebViewCustomMethod">bots.invokeWebViewCustomMethod</a> method, if the method call succeeded</li>
<li><code>error</code> - The text of the RPC error, if the method call failed</li>
</ul>
<h4><a class="anchor" href="#web-app-read-text-from-clipboard" id="web-app-read-text-from-clipboard" name="web-app-read-text-from-clipboard"><i class="anchor-icon"></i></a><code>web_app_read_text_from_clipboard</code></h4>
<p>Event data: a JSON object with the following fields:</p>
<ul>
<li><code>req_id</code> - A string with the ID of the current request</li>
</ul>
<p>Emitted by <a href="/api/bots/webapps">bot mini apps</a> to obtain the contents of the system clipboard. </p>
<p>Only for Mini Apps owned by bots added to the <a href="/api/bots/attach">attachment menu</a>, regardles of how the Mini App itself was launched, this event should trigger a <a href="/api/bots/webapps#clipboard-text-received">clipboard_text_received event »</a> with the following payload: </p>
<ul>
<li><code>req_id</code> - The <code>req_id</code> from the <code>web_app_read_text_from_clipboard</code> request</li>
<li><code>data</code> - A string with the clipboard contents</li>
</ul>
<p>Note that user interactions must have a TTL of 10 seconds: events of this type must be ignored and a <a href="/api/bots/webapps#clipboard-text-received">clipboard_text_received event »</a> with the correct <code>req_id</code> and no <code>data</code> field must be sent if the last Mini App user interaction happened more than 10 seconds ago. </p>
<p>A <a href="/api/bots/webapps#clipboard-text-received">clipboard_text_received event »</a> with the correct <code>req_id</code> and no <code>data</code> field must also be sent if the bot is not installed in the <a href="/api/bots/attach">attachment menu</a>.</p>
<h4><a class="anchor" href="#web-app-setup-closing-behavior" id="web-app-setup-closing-behavior" name="web-app-setup-closing-behavior"><i class="anchor-icon"></i></a><code>web_app_setup_closing_behavior</code></h4>
<p>Event data: a JSON object with a boolean <code>need_confirmation</code>.</p>
<p>If equal to <code>true</code>, the client should require user confirmation with a "Changes that you made may not be saved." popup with "Cancel"/"Close anyway" buttons before closing the webview, to avoid accidentally aborting a sensitive operation; otherwise no confirmation should be requested. </p>
@ -93,11 +137,16 @@ While handling is enabled, maximum 3 consecutive valid events of this type can b
<p>Event data: a JSON object with a string <code>color</code> with a hex RGB color. </p>
<p>Used to set the mini app background and lower overscroll color. </p>
<h4><a class="anchor" href="#web-app-set-header-color" id="web-app-set-header-color" name="web-app-set-header-color"><i class="anchor-icon"></i></a><code>web_app_set_header_color</code></h4>
<p>Event data: a JSON object with a string <code>color_key</code>, with of the following values:</p>
<p>Event data: a JSON object with the following fields:</p>
<ul>
<li><code>color_key</code> - A string with one of the following values:<ul>
<li><code>bg_color</code> - The <code>bg_color</code> from the <a href="/api/bots/webapps#theme-parameters">theme parameters</a> should be used.</li>
<li><code>secondary_bg_color</code> - The <code>secondary_bg_color</code> from the <a href="/api/bots/webapps#theme-parameters">theme parameters</a> should be used.</li>
</ul>
</li>
<li><code>color</code> - A color in hex RGB format (<code>#ffffff</code>).</li>
</ul>
<p>The two fields are mutually exclusive, if none of the two fields are provided the default header color is used.</p>
<p>Used to set the mini app header and upper overscroll color. </p>
<h4><a class="anchor" href="#web-app-data-send" id="web-app-data-send" name="web-app-data-send"><i class="anchor-icon"></i></a><code>web_app_data_send</code></h4>
<p>Event data: a JSON object with a string <code>data</code> field. </p>

View file

@ -2463,7 +2463,7 @@ a.tm-table-action-link:hover {
line-height: 42px;
font-weight: bold;
padding: 12px 20px;
background-color: var(--table-header-bg-color);
background-color: var(--field-bg-color);
border-radius: var(--def-border-radius);
color: var(--field-color);
text-align: center;
@ -2548,6 +2548,70 @@ a.tm-table-action-link:hover {
filter: blur(7px);
}
.tm-field-hint {
margin: 8px 14px;
}
.tm-number-form-group {
margin: 36px 0 0;
}
.tm-checkbox-toggle {
position: relative;
font-weight: normal;
font-size: 14px;
line-height: 20px;
padding: 11px 14px;
cursor: pointer;
-webkit-user-select: none;
user-select: none;
}
.tm-checkbox-toggle .checkbox {
position: absolute;
top: 0;
bottom: 0;
right: 0;
margin: auto 24px;
}
.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:before,
.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:after {
position: absolute;
right: 0;
top: 0;
content: '';
}
.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:before {
margin: 11px 13px;
width: 36px;
height: 20px;
border-radius: 10px;
background-color: #64717f;
transition: var(--def-transition) background-color;
}
.tm-checkbox-toggle .checkbox:checked ~ .tm-checkbox-label:before {
background-color: #149efa;
}
.tm-checkbox-toggle .checkbox ~ .tm-checkbox-label:after {
width: 16px;
height: 16px;
margin: 13px;
border-radius: 8px;
background-color: #fff;
right: 18px;
transform: translateX(0);
transition: var(--def-transition) transform;
}
.tm-checkbox-toggle .checkbox:checked ~ .tm-checkbox-label:after {
background-color: #fff;
transform: translateX(16px);
}
.cant-receive,
.codes-disabled .can-receive {
display: none;
}
.codes-disabled .cant-receive {
display: block;
}