diff --git a/docs/content/en/guide/forward.md b/docs/content/en/guide/forward.md index e69c34cada..4bd5946a12 100644 --- a/docs/content/en/guide/forward.md +++ b/docs/content/en/guide/forward.md @@ -71,7 +71,7 @@ Pass a file name if the expression is complex: {{< details "router.txt" >}} Write your expression like `switch`: -``` +```javascript Message.Message contains "foo" ? "CHAT1" : From.ID == 123456 ? "CHAT2" : Message.Views > 30 ? { Peer: "CHAT3", Thread: 101 } : @@ -111,6 +111,61 @@ Some message content can't be copied, such as poll, invoice, etc. They will be i tdl forward --from tdl-export.json --mode clone {{< /command >}} +## Edit + +Edit the message before forwarding based on [expression](/reference/expr). + +{{< hint info >}} +- You must pass the first message of grouped photos to edit the caption. +- You can pass any message of grouped documents to edit the corresponding comment. +{{< /hint >}} + +You can reference relevant fields from the original message in the expression. + +List all available fields: +{{< command >}} +tdl forward --from tdl-export.json --edit - +{{< /command >}} + +Append `Test Forwarded Message` to the original message: +{{< command >}} +tdl forward --from tdl-export.json --edit 'Message.Message + " Test Forwarded Message"' +{{< /command >}} + +Write styled message with [HTML](https://core.telegram.org/bots/api#html-style): +{{< command >}} +tdl forward --from tdl-export.json --edit \ + 'Message.Message + `Bold Link`' +{{< /command >}} + +Pass a file name if the expression is complex: + +{{< details "edit.txt" >}} +```javascript +repeat(Message.Message, 2) + ` +Google +Bing +bold +italic +code +spoiler +

+package main
+
+import "fmt"
+
+func main() {
+    fmt.Println("hello world")
+}
+
+` + From.VisibleName +``` +{{< /details >}} + +{{< command >}} +tdl forward --from tdl-export.json --edit edit.txt +{{< /command >}} + ## Dry Run Print the progress without actually sending messages, which is useful for message routing debugging. @@ -126,3 +181,21 @@ Send messages without notification. {{< command >}} tdl forward --from tdl-export.json --silent {{< /command >}} + +## No Grouped Detection + +By default, tdl will detect grouped messages and forward them as an album. + +You can disable this behavior by `--single` to forward it as a single message. + +{{< command >}} +tdl forward --from tdl-export.json --single +{{< /command >}} + +## Descending Order + +Forward messages in descending order for each source. + +{{< command >}} +tdl forward --from tdl-export.json --desc +{{< /command >}} diff --git a/docs/content/zh/guide/forward.md b/docs/content/zh/guide/forward.md index 769f2fba06..dac674fee2 100644 --- a/docs/content/zh/guide/forward.md +++ b/docs/content/zh/guide/forward.md @@ -72,7 +72,7 @@ tdl forward --from tdl-export.json \ {{< details "router.txt" >}} 你可以像写 `switch` 一样编写表达式: -``` +```javascript Message.Message contains "foo" ? "CHAT1" : From.ID == 123456 ? "CHAT2" : Message.Views > 30 ? { Peer: "CHAT3", Thread: 101 } : @@ -113,6 +113,61 @@ tdl forward --from tdl-export.json --mode direct tdl forward --from tdl-export.json --mode clone {{< /command >}} +## 编辑 + +使用[表达式引擎](/reference/expr)编辑转发前的消息。 + +{{< hint info >}} +- 你必须传递合并照片的第一条消息才能编辑标题。 +- 你可以传递任何合并文档的消息以编辑相应的评论。 +{{< /hint >}} + +你可以在表达式中引用原始消息的相关字段。 + +列出所有可用字段: +{{< command >}} +tdl forward --from tdl-export.json --edit - +{{< /command >}} + +在原始消息后附加 `测试转发消息`: +{{< command >}} +tdl forward --from tdl-export.json --edit 'Message.Message + " 测试转发消息"' +{{< /command >}} + +以[HTML](https://core.telegram.org/bots/api#html-style)格式编写带有样式的消息: +{{< command >}} +tdl forward --from tdl-export.json --edit \ +'Message.Message + `粗体 链接`' +{{< /command >}} + +如果表达式较复杂,可以传递文件名: + +{{< details "edit.txt" >}} +```javascript +repeat(Message.Message, 2) + ` +谷歌 +必应 +粗体 +斜体 +代码 +剧透 +

+package main
+
+import "fmt"
+
+func main() {
+    fmt.Println("hello world")
+}
+
+` + From.VisibleName +``` +{{< /details >}} + +{{< command >}} +tdl forward --from tdl-export.json --edit edit.txt +{{< /command >}} + ## 试运行 只打印进度而不实际发送消息,可以用于调试消息路由的效果。 @@ -129,3 +184,20 @@ tdl forward --from tdl-export.json --dry-run tdl forward --from tdl-export.json --silent {{< /command >}} +## 取消分组检测 + +默认情况下,tdl 将自动探测到分组消息并将它们转发为合并的消息。 + +你可以通过 `--single` 禁用此行为,将其作为单个消息转发。 + +{{< command >}} +tdl forward --from tdl-export.json --single +{{< /command >}} + +## 反序 + +对每个来源的消息进行反序转发。 + +{{< command >}} +tdl forward --from tdl-export.json --desc +{{< /command >}}