diff --git a/site/docs/guide/basics.md b/site/docs/guide/basics.md index 41fc22ead..0b60a7da2 100644 --- a/site/docs/guide/basics.md +++ b/site/docs/guide/basics.md @@ -131,3 +131,19 @@ bot.command("start", async (ctx) => { }); }); ``` + +## Editing Messages + +You can edit a message sent by your bot like this: + +```ts +bot.command("think", async (ctx) => { + const msg = await ctx.reply("Thinking..."); + + const newText = await getSomeNewText(); + + await ctx.api.editMessageText(ctx.chatId, msg.message_id, newText); +}); +``` + +> Consider using the [hydrate plugin](../plugins/hydrate) which simplifies message editing. diff --git a/site/docs/id/guide/basics.md b/site/docs/id/guide/basics.md index 993fc1aa5..e01d8333b 100644 --- a/site/docs/id/guide/basics.md +++ b/site/docs/id/guide/basics.md @@ -137,3 +137,17 @@ bot.command("start", async (ctx) => { ); }); ``` +## Edit Pesan +Kamu dapat mengedit pesan yang dikirim oleh bot milikmu seperti ini: + +```ts +bot.command("think", async (ctx) => { + const msg = await ctx.reply("Berpikir..."); + + const newText = await getSomeNewText(); + + await ctx.api.editMessageText(ctx.chatId, msg.message_id, newText); +}); +``` + +> Pertimbangkan untuk menggunakan [plugin hydrate](../plugins/hydrate), yang memudahkan pengeditan pesan. diff --git a/site/docs/uk/guide/basics.md b/site/docs/uk/guide/basics.md index cbb0fb94b..12f3cd54f 100644 --- a/site/docs/uk/guide/basics.md +++ b/site/docs/uk/guide/basics.md @@ -131,3 +131,19 @@ bot.command("start", async (ctx) => { ); }); ``` + +## Редагування повідомлень + +Ви можете відредагувати повідомлення, надіслане вашим ботом, наступним чином: + +```ts +bot.command("think", async (ctx) => { + const msg = await ctx.reply("Думаю..."); + + const newText = await getSomeNewText(); + + await ctx.api.editMessageText(ctx.chatId, msg.message_id, newText); +}); +``` + +> Рекомендуємо використати [плагін hydrate](../plugins/hydrate), який спрощує редагування повідомлень. diff --git a/site/docs/zh/guide/basics.md b/site/docs/zh/guide/basics.md index a023729ba..5416aa5b6 100644 --- a/site/docs/zh/guide/basics.md +++ b/site/docs/zh/guide/basics.md @@ -131,3 +131,19 @@ bot.command("start", async (ctx) => { }); }); ``` + +## 编辑信息 + +你可以像这样编辑你的 bot 发送的信息: + +```ts +bot.command("think", async (ctx) => { + const msg = await ctx.reply("深度思考中……"); + + const newText = await getSomeNewText(); + + await ctx.api.editMessageText(ctx.chatId, msg.message_id, newText); +}); +``` + +> 考虑使用 [hydrate 插件](../plugins/hydrate),它可以简化信息编辑。