messages.GetInlineBotResults
Query an inline bot
Example
const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result = await client.invoke(
new Api.messages.GetInlineBotResults({
bot: "username",
peer: "username",
query: "some string here",
offset: "some string here",
geoPoint: new Api.InputGeoPoint({
lat: 8.24,
long: 8.24,
accuracyRadius: 43,
}),
})
);
console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result: Api.messages.BotResults = await client.invoke(
new Api.messages.GetInlineBotResults({
bot: "username",
peer: "username",
query: "some string here",
offset: "some string here",
geoPoint: new Api.InputGeoPoint({
lat: 8.24,
long: 8.24,
accuracyRadius: 43,
}),
})
);
console.log(result); // prints the result
})();
Parameters
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
bot | InputUser | The bot to query |
peer | InputPeer | The currently opened chat |
geoPoint | flags.0?InputGeoPoint | The geolocation, if requested |
query | string | The query |
offset | string | The offset within the results, will be passed directly as-is to the bot. |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | BOT_INLINE_DISABLED | This bot can't be used in inline mode. |
400 | BOT_INVALID | This is not a valid bot. |
400 | BOT_RESPONSE_TIMEOUT | A timeout occurred while fetching data from the bot. |
400 | CHANNEL_INVALID | The provided channel is invalid. |
400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
400 | INPUT_USER_DEACTIVATED | The specified user was deleted. |
400 | MSG_ID_INVALID | Invalid message ID provided. |
-503 | Timeout | Timeout while fetching data. |
Can bots use this method?
No