mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-29 15:59:13 +01:00
Update content of files
This commit is contained in:
parent
4362d7e82a
commit
25ab8eb006
1 changed files with 35 additions and 0 deletions
|
@ -1121,6 +1121,41 @@
|
||||||
}
|
}
|
||||||
WebView.postEvent('web_app_data_send', false, {data: data});
|
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) {
|
WebApp.openLink = function (url, options) {
|
||||||
var a = document.createElement('A');
|
var a = document.createElement('A');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
|
Loading…
Reference in a new issue