2.0.8 • Published 10 months ago

@roziscoding/grammy-autoquote v2.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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:

autoQuote({ allowSendingWithoutReply: true });

For a single context

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

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();
2.0.8

10 months ago

2.0.7

10 months ago

2.0.6

1 year ago

2.0.3

1 year ago

2.0.4

1 year ago

2.0.0

1 year ago

1.1.2

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago