GramJS

⚠️ This project is archived and no longer maintained. Development continues in teleproto, an actively maintained fork. It's largely compatible with GramJS for most projects, migration means little more than swapping the package:
npm install teleproto
See the migration guide for details.

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

NameTypeDescription
flags#Flags, see TL conditional fields
botInputUserThe bot to query
peerInputPeerThe currently opened chat
geoPointflags.0?InputGeoPointThe geolocation, if requested
querystringThe query
offsetstringThe offset within the results, will be passed directly as-is to the bot.

Result

messages.BotResults

Possible errors

CodeTypeDescription
400BOT_INLINE_DISABLEDThis bot can't be used in inline mode.
400BOT_INVALIDThis is not a valid bot.
400BOT_RESPONSE_TIMEOUTA timeout occurred while fetching data from the bot.
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
-503TimeoutTimeout while fetching data.

Can bots use this method?

No