Skip to main content
Home

Built and signed on GitHub Actions

Unofficial grammY plugin that automatically quotes user messages

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (2.0.4)

Auto quote plugin for grammY

JSR JSR Score

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({ allow_send_without_reply: 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, { allow_send_without_reply: 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({ allow_send_without_reply: 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();
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@roz/grammy-autoquote

Import symbol

import * as grammy_autoquote from "@roz/grammy-autoquote";
or

Import directly with a jsr specifier

import * as grammy_autoquote from "jsr:@roz/grammy-autoquote";

Add Package

pnpm i jsr:@roz/grammy-autoquote
or (using pnpm 10.8 or older)
pnpm dlx jsr add @roz/grammy-autoquote

Import symbol

import * as grammy_autoquote from "@roz/grammy-autoquote";

Add Package

yarn add jsr:@roz/grammy-autoquote
or (using Yarn 4.8 or older)
yarn dlx jsr add @roz/grammy-autoquote

Import symbol

import * as grammy_autoquote from "@roz/grammy-autoquote";

Add Package

npx jsr add @roz/grammy-autoquote

Import symbol

import * as grammy_autoquote from "@roz/grammy-autoquote";

Add Package

bunx jsr add @roz/grammy-autoquote

Import symbol

import * as grammy_autoquote from "@roz/grammy-autoquote";