Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Nov 30, 2024
1 parent dfacfe3 commit 8cb18fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
);
```
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AnswerCallbackQueryParams>,
) {
return new Plugin("@gramio/auto-answer-callback-query").on(
"callback_query",
async (context, next) => {
Expand Down

0 comments on commit 8cb18fc

Please sign in to comment.