Skip to content

Commit 0e1ce1d

Browse files
authored
docs(hugo): add --edit --single --desc docs (#497)
1 parent 56e4812 commit 0e1ce1d

2 files changed

Lines changed: 147 additions & 2 deletions

File tree

docs/content/en/guide/forward.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Pass a file name if the expression is complex:
7171

7272
{{< details "router.txt" >}}
7373
Write your expression like `switch`:
74-
```
74+
```javascript
7575
Message.Message contains "foo" ? "CHAT1" :
7676
From.ID == 123456 ? "CHAT2" :
7777
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
111111
tdl forward --from tdl-export.json --mode clone
112112
{{< /command >}}
113113

114+
## Edit
115+
116+
Edit the message before forwarding based on [expression](/reference/expr).
117+
118+
{{< hint info >}}
119+
- You must pass the first message of grouped photos to edit the caption.
120+
- You can pass any message of grouped documents to edit the corresponding comment.
121+
{{< /hint >}}
122+
123+
You can reference relevant fields from the original message in the expression.
124+
125+
List all available fields:
126+
{{< command >}}
127+
tdl forward --from tdl-export.json --edit -
128+
{{< /command >}}
129+
130+
Append `Test Forwarded Message` to the original message:
131+
{{< command >}}
132+
tdl forward --from tdl-export.json --edit 'Message.Message + " Test Forwarded Message"'
133+
{{< /command >}}
134+
135+
Write styled message with [HTML](https://core.telegram.org/bots/api#html-style):
136+
{{< command >}}
137+
tdl forward --from tdl-export.json --edit \
138+
'Message.Message + `<b>Bold</b> <a href="https://example.com">Link</a>`'
139+
{{< /command >}}
140+
141+
Pass a file name if the expression is complex:
142+
143+
{{< details "edit.txt" >}}
144+
```javascript
145+
repeat(Message.Message, 2) + `
146+
<a href="https://www.google.com">Google</a>
147+
<a href="https://www.bing.com">Bing</a>
148+
<b>bold</b>
149+
<i>italic</i>
150+
<code>code</code>
151+
<tg-spoiler>spoiler</tg-spoiler>
152+
<pre><code class="language-go">
153+
package main
154+
155+
import "fmt"
156+
157+
func main() {
158+
fmt.Println("hello world")
159+
}
160+
</code></pre>
161+
` + From.VisibleName
162+
```
163+
{{< /details >}}
164+
165+
{{< command >}}
166+
tdl forward --from tdl-export.json --edit edit.txt
167+
{{< /command >}}
168+
114169
## Dry Run
115170

116171
Print the progress without actually sending messages, which is useful for message routing debugging.
@@ -126,3 +181,21 @@ Send messages without notification.
126181
{{< command >}}
127182
tdl forward --from tdl-export.json --silent
128183
{{< /command >}}
184+
185+
## No Grouped Detection
186+
187+
By default, tdl will detect grouped messages and forward them as an album.
188+
189+
You can disable this behavior by `--single` to forward it as a single message.
190+
191+
{{< command >}}
192+
tdl forward --from tdl-export.json --single
193+
{{< /command >}}
194+
195+
## Descending Order
196+
197+
Forward messages in descending order for each source.
198+
199+
{{< command >}}
200+
tdl forward --from tdl-export.json --desc
201+
{{< /command >}}

docs/content/zh/guide/forward.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ tdl forward --from tdl-export.json \
7272
{{< details "router.txt" >}}
7373
你可以像写 `switch` 一样编写表达式:
7474

75-
```
75+
```javascript
7676
Message.Message contains "foo" ? "CHAT1" :
7777
From.ID == 123456 ? "CHAT2" :
7878
Message.Views > 30 ? { Peer: "CHAT3", Thread: 101 } :
@@ -113,6 +113,61 @@ tdl forward --from tdl-export.json --mode direct
113113
tdl forward --from tdl-export.json --mode clone
114114
{{< /command >}}
115115

116+
## 编辑
117+
118+
使用[表达式引擎](/reference/expr)编辑转发前的消息。
119+
120+
{{< hint info >}}
121+
- 你必须传递合并照片的第一条消息才能编辑标题。
122+
- 你可以传递任何合并文档的消息以编辑相应的评论。
123+
{{< /hint >}}
124+
125+
你可以在表达式中引用原始消息的相关字段。
126+
127+
列出所有可用字段:
128+
{{< command >}}
129+
tdl forward --from tdl-export.json --edit -
130+
{{< /command >}}
131+
132+
在原始消息后附加 `测试转发消息`
133+
{{< command >}}
134+
tdl forward --from tdl-export.json --edit 'Message.Message + " 测试转发消息"'
135+
{{< /command >}}
136+
137+
[HTML](https://core.telegram.org/bots/api#html-style)格式编写带有样式的消息:
138+
{{< command >}}
139+
tdl forward --from tdl-export.json --edit \
140+
'Message.Message + `<b>粗体</b> <a href="https://example.com">链接</a>`'
141+
{{< /command >}}
142+
143+
如果表达式较复杂,可以传递文件名:
144+
145+
{{< details "edit.txt" >}}
146+
```javascript
147+
repeat(Message.Message, 2) + `
148+
<a href="https://www.google.com">谷歌</a>
149+
<a href="https://www.bing.com">必应</a>
150+
<b>粗体</b>
151+
<i>斜体</i>
152+
<code>代码</code>
153+
<tg-spoiler>剧透</tg-spoiler>
154+
<pre><code class="language-go">
155+
package main
156+
157+
import "fmt"
158+
159+
func main() {
160+
fmt.Println("hello world")
161+
}
162+
</code></pre>
163+
` + From.VisibleName
164+
```
165+
{{< /details >}}
166+
167+
{{< command >}}
168+
tdl forward --from tdl-export.json --edit edit.txt
169+
{{< /command >}}
170+
116171
## 试运行
117172

118173
只打印进度而不实际发送消息,可以用于调试消息路由的效果。
@@ -129,3 +184,20 @@ tdl forward --from tdl-export.json --dry-run
129184
tdl forward --from tdl-export.json --silent
130185
{{< /command >}}
131186

187+
## 取消分组检测
188+
189+
默认情况下,tdl 将自动探测到分组消息并将它们转发为合并的消息。
190+
191+
你可以通过 `--single` 禁用此行为,将其作为单个消息转发。
192+
193+
{{< command >}}
194+
tdl forward --from tdl-export.json --single
195+
{{< /command >}}
196+
197+
## 反序
198+
199+
对每个来源的消息进行反序转发。
200+
201+
{{< command >}}
202+
tdl forward --from tdl-export.json --desc
203+
{{< /command >}}

0 commit comments

Comments
 (0)