messages.EditInlineBotMessage
Edit an inline bot message
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.EditInlineBotMessage({
id: new Api.InputBotInlineMessageID({
dcId: 43,
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
}),
noWebpage: true,
message: "Hello there!",
media: new Api.InputMediaUploadedPhoto({
file: await client.uploadFile({
file: new CustomFile(
"file.bin",
fs.statSync("../file.bin").size,
"../file.bin"
),
workers: 1,
}),
stickers: [
new Api.InputDocument({
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
fileReference: Buffer.from("arbitrary data here"),
}),
],
ttlSeconds: 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.Bool = await client.invoke(
new Api.messages.EditInlineBotMessage({
id: new Api.InputBotInlineMessageID({
dcId: 43,
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
}),
noWebpage: true,
message: "Hello there!",
media: new Api.InputMediaUploadedPhoto({
file: await client.uploadFile({
file: new CustomFile(
"file.bin",
fs.statSync("../file.bin").size,
"../file.bin"
),
workers: 1,
}),
stickers: [
new Api.InputDocument({
id: BigInt("-4156887774564"),
accessHash: BigInt("-4156887774564"),
fileReference: Buffer.from("arbitrary data here"),
}),
],
ttlSeconds: 43,
}),
})
);
console.log(result); // prints the result
})();
Parameters
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
noWebpage | flags.1?true | Disable webpage preview |
id | InputBotInlineMessageID | Sent inline message ID |
message | flags.11?string | Message |
media | flags.14?InputMedia | Media |
replyMarkup | flags.2?ReplyMarkup | Reply markup for inline keyboards |
entities | flags.3?Vector<MessageEntity> | Message entities for styled text |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | MESSAGE_ID_INVALID | The provided message id is invalid. |
400 | MESSAGE_NOT_MODIFIED | The provided message data is identical to the previous message data, the message wasn't modified. |
Can bots use this method?
Yes
Related pages
Styled text with message entities
How to create styled text with message entities