diff --git a/site/docs/.vuepress/config.ts b/site/docs/.vuepress/config.ts
index 936080766..fff125791 100644
--- a/site/docs/.vuepress/config.ts
+++ b/site/docs/.vuepress/config.ts
@@ -250,6 +250,10 @@ export default defineUserConfig({
text: "Useful Middleware",
link: "/plugins/middlewares.html",
},
+ {
+ text: "Autoquote",
+ link: "/plugins/autoquote.html",
+ },
{
text: "[Submit your PR!]",
link: "/plugins/#submitting-your-own-package-to-the-docs",
@@ -972,6 +976,10 @@ export default defineUserConfig({
text: "有用的中间件",
link: "/zh/plugins/middlewares.html",
},
+ {
+ text: "自动引用",
+ link: "/zh/plugins/autoquote.html",
+ },
{
text: "[等待你的 PR!]",
link: "/zh/plugins/#向文档提交你自己的插件",
diff --git a/site/docs/.vuepress/plugins/current-versions/modules.json b/site/docs/.vuepress/plugins/current-versions/modules.json
index 0f1a8ec49..76ff9a8c5 100644
--- a/site/docs/.vuepress/plugins/current-versions/modules.json
+++ b/site/docs/.vuepress/plugins/current-versions/modules.json
@@ -11,6 +11,7 @@
"grammy_emoji",
"grammy_parse_mode",
"grammy_storages",
- "grammy_conversations"
+ "grammy_conversations",
+ "grammy_autoquote"
]
}
diff --git a/site/docs/plugins/autoquote.md b/site/docs/plugins/autoquote.md
new file mode 100644
index 000000000..0aa8c53bb
--- /dev/null
+++ b/site/docs/plugins/autoquote.md
@@ -0,0 +1,146 @@
+# Always Replying to Messages
+
+It is sometimes necessary to always send messages as replies, especially for bots that are meant to be used in groups.
+We usually do this by adding the `reply_to_message_id` parameter to the methods that send the message: `sendText`, `reply`, `sendPhoto`, `replyWithPhoto` and etc.
+However, if you're doing this for every single message, it can get messy and boring.
+
+This plugin sets the `reply_to_message_id` parameter to `ctx.msg.message_id` for all `reply*` and `send*` methods that support it to make every message a reply to the message that triggered it.
+
+## Usage
+
+### In Specific Routes
+
+If you want all messages sent within a specific context (like a specific command), you can specifically apply the plugin to them:
+
+
+
+
+```ts
+import { Bot } from "grammy";
+import { addReplyParam } from "@roziscoding/grammy-autoquote";
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.start();
+```
+
+
+
+
+```js
+const { Bot } = require("grammy");
+const { addReplyParam } = require("@roziscoding/grammy-autoquote");
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.start();
+```
+
+
+
+
+```ts
+import { Bot } from "https://deno.land/x/grammy/mod.ts";
+import { addReplyParam } from "https://deno.land/x/grammy_autoquote/mod.ts";
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.start();
+```
+
+
+
+
+### In for All Routes
+
+If you want every sent message to reply the messages that triggered them, you can apply the plugin this way:
+
+
+
+
+```ts
+import { Bot } from "grammy";
+import { autoQuote } from "@roziscoding/grammy-autoquote";
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // this quotes the user's message, too
+});
+
+bot.start();
+```
+
+
+
+
+```js
+const { Bot } = require("grammy");
+const { autoQuote } = require("@roziscoding/grammy-autoquote");
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // this quotes the user's message, too
+});
+
+bot.start();
+```
+
+
+
+
+```ts
+import { Bot } from "https://deno.land/x/grammy/mod.ts";
+import { autoQuote } from "https://deno.land/x/grammy_autoquote/mod.ts";
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // this is going to quote the user's message
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // this quotes the user's message, too
+});
+
+bot.start();
+```
+
+
+
+
+## Plugin Summary
+
+- Name: Autoquote
+- Source:
+- API Reference:
diff --git a/site/docs/zh/plugins/autoquote.md b/site/docs/zh/plugins/autoquote.md
new file mode 100644
index 000000000..6d313c6a3
--- /dev/null
+++ b/site/docs/zh/plugins/autoquote.md
@@ -0,0 +1,146 @@
+# 总是回复消息
+
+有时候有必要总是将消息作为回复发送,特别是对于那些打算要在群组中使用的 bot。
+我们通常通过在发送消息的方法中添加 `reply_to_message_id` 参数来实现这一点:`sendText`, `reply`, `sendPhoto`, `replyWithPhoto` 等等。
+然而,如果你对每一条消息都这样做,这会使得代码变得很无聊和繁琐。
+
+这个插件将所有 `reply*` 和 `send*` 方法的 `reply_to_message_id` 参数设置为 `ctx.msg.message_id`,以便每条消息都是对触发这条消息的回复。
+
+## 使用方式
+
+### 在指定的路由中
+
+如果你想让所有在特定上下文的消息进行回复(比如特定的命令),你可以专门应用这个插件到它们上面:
+
+
+
+
+```ts
+import { Bot } from "grammy";
+import { addReplyParam } from "@roziscoding/grammy-autoquote";
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+```js
+const { Bot } = require("grammy");
+const { addReplyParam } = require("@roziscoding/grammy-autoquote");
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+```ts
+import { Bot } from "https://deno.land/x/grammy/mod.ts";
+import { addReplyParam } from "https://deno.land/x/grammy_autoquote/mod.ts";
+
+const bot = new Bot("");
+
+bot.command("demo", async (ctx) => {
+ ctx.api.config.use(addReplyParam(ctx));
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+### 在所有路由中
+
+如果你希望每条发送的消息都回复触发它的消息,你可以通过这样的方式应用这个插件:
+
+
+
+
+```ts
+import { Bot } from "grammy";
+import { autoQuote } from "@roziscoding/grammy-autoquote";
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // 这也会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+```js
+const { Bot } = require("grammy");
+const { autoQuote } = require("@roziscoding/grammy-autoquote");
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // 这也会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+```ts
+import { Bot } from "https://deno.land/x/grammy/mod.ts";
+import { autoQuote } from "https://deno.land/x/grammy_autoquote/mod.ts";
+
+const bot = new Bot("");
+
+bot.use(autoQuote);
+
+bot.command("demo", async (ctx) => {
+ await ctx.reply("Demo command!"); // 这将会引用用户的消息
+});
+
+bot.command("hello", async (ctx) => {
+ await ctx.reply("Hi there :)"); // 这也会引用用户的消息
+});
+
+bot.start();
+```
+
+
+
+
+## 插件概述
+
+- 名字:Autoquote
+- 源码:
+- API 参考: