Update content of files

This commit is contained in:
GitHub Action 2023-02-21 19:07:49 +00:00
parent 4362d7e82a
commit 25ab8eb006

View file

@ -1121,6 +1121,41 @@
}
WebView.postEvent('web_app_data_send', false, {data: data});
};
WebApp.switchInlineQuery = function (query, choose_chat_types) {
if (!versionAtLeast('6.6')) {
console.error('[Telegram.WebApp] Method switchInlineQuery is not supported in version ' + webAppVersion);
throw Error('WebAppMethodUnsupported');
}
if (!initParams.tgWebAppBotInline) {
console.error('[Telegram.WebApp] Inline mode is disabled for this bot. Read more about inline mode: https://core.telegram.org/bots/inline');
throw Error('WebAppInlineModeDisabled');
}
query = query || '';
if (query.length > 256) {
console.error('[Telegram.WebApp] Inline query is too long', query);
throw Error('WebAppInlineQueryInvalid');
}
var chat_types = [];
if (choose_chat_types) {
if (!Array.isArray(choose_chat_types)) {
console.error('[Telegram.WebApp] Choose chat types should be an array', choose_chat_types);
throw Error('WebAppInlineChooseChatTypesInvalid');
}
var good_types = {users: 1, bots: 1, groups: 1, channels: 1};
for (var i = 0; i < choose_chat_types.length; i++) {
var chat_type = choose_chat_types[i];
if (!good_types[chat_type]) {
console.error('[Telegram.WebApp] Choose chat type is invalid', chat_type);
throw Error('WebAppInlineChooseChatTypeInvalid');
}
if (good_types[chat_type] != 2) {
good_types[chat_type] = 2;
chat_types.push(chat_type);
}
}
}
WebView.postEvent('web_app_switch_inline_query', false, {query: query, chat_types: chat_types});
};
WebApp.openLink = function (url, options) {
var a = document.createElement('A');
a.href = url;