From 8cb18fcba9a53560a1bd7cae7289553ff109639d Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Sat, 30 Nov 2024 03:32:45 +0300 Subject: [PATCH] chore: update README --- README.md | 19 +++++++++++++++++-- src/index.ts | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 649026b..5c99847 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,24 @@ const bot = new Bot(process.env.BOT_TOKEN as string) }) ) .callbackQuery("test", () => { - return context.send("Hii"); // The plugin will call an answerCallbackQuery method since you didn't do it + // The plugin will call an answerCallbackQuery method since you didn't do it + return context.send("Hii"); }) .callbackQuery("test2", (context) => { - return context.answer("HII"); // you already answered so plugin won't try to answer + // you already answered so plugin won't try to answer + return context.answer("HII"); }); ``` + +### Params + +You can pass params for [answerCallbackQuery](https://core.telegram.org/bots/api#answercallbackquery) method + +```ts +bot.extend( + autoAnswerCallbackQuery({ + text: "auto-answered", + show_alert: true, + }) +); +``` diff --git a/src/index.ts b/src/index.ts index b665b40..93ac3fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,7 +37,9 @@ import { * * @param params Params object for {@link APIMethods.answerCallbackQuery | answerCallbackQuery} method */ -export function autoAnswerCallbackQuery(params?: AnswerCallbackQueryParams) { +export function autoAnswerCallbackQuery( + params?: Partial, +) { return new Plugin("@gramio/auto-answer-callback-query").on( "callback_query", async (context, next) => {