Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roziscoding/grammy-autoquote
grammY plugin that forces all sent messages to quote the last received one
https://github.com/roziscoding/grammy-autoquote
bot grammy grammyjs hacktoberfest telegram telegram-bot
Last synced: 3 months ago
JSON representation
grammY plugin that forces all sent messages to quote the last received one
- Host: GitHub
- URL: https://github.com/roziscoding/grammy-autoquote
- Owner: roziscoding
- License: mit
- Created: 2022-07-21T17:02:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T15:54:23.000Z (4 months ago)
- Last Synced: 2024-10-12T13:28:00.088Z (3 months ago)
- Topics: bot, grammy, grammyjs, hacktoberfest, telegram, telegram-bot
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Auto quote plugin for grammY
This plugin provides a convenient way to quote the user's message when replying to them.
## How does it work
This plugin works by setting `reply_to_message_id` param to the value of `ctx.msg.message_id` for every API method that starts with `send` (except for `sendChatAction`).
## Usage
### Reply Parameters
The plugin supports specifying the `allow_send_without_reply` parameter, which will allow the bot to send messages without quoting the user's message. To do so, just pass an object to the plugin initializer like so:
```ts
autoQuote({ allowSendingWithoutReply: true });
```### For a single context
```ts
import { Bot } from "grammy";
import { addReplyParam } from "@roz/grammy-autoquote";const bot = new Bot("");
bot.command("demo", async (ctx) => {
ctx.api.config.use(addReplyParam(ctx));
// ctx.api.config.use(addReplyParam(ctx, { allowSendingWithoutReply: true }));ctx.reply("Demo command!"); // This will quote the user's message
});bot.start();
```### For every context
```ts
import { Bot } from "grammy";
import { autoQuote } from "@roz/grammy-autoquote";const bot = new Bot("");
bot.use(autoQuote());
// bot.use(autoQuote({ allowSendingWithoutReply: true }));bot.command("demo", async (ctx) => {
ctx.reply("Demo command!"); // This will quote the user's message
});bot.command("hello", async (ctx) => {
ctx.reply("Hi there :)"); // Also quotes the user's message
});bot.start();
```