Skip to content

Commit

Permalink
feat(download): add FileCaption to download template (#560)
Browse files Browse the repository at this point in the history
* feat(download): add FileCaption to download template

* doc(template.md): add FileCaption description
  • Loading branch information
XMLHexagram committed Apr 17, 2024
1 parent 51677e6 commit 91b1e17
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions app/dl/iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type fileTemplate struct {
MessageID int
MessageDate int64
FileName string
FileCaption string
FileSize string
DownloadDate int64
}
Expand Down Expand Up @@ -177,6 +178,7 @@ func (i *iter) process(ctx context.Context) (ret bool, skip bool) {
MessageID: message.ID,
MessageDate: int64(message.Date),
FileName: item.Name,
FileCaption: message.Message,
FileSize: utils.Byte.FormatBinaryBytes(item.Size),
DownloadDate: time.Now().Unix(),
})
Expand Down
17 changes: 9 additions & 8 deletions docs/content/en/guide/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Template syntax is based on [Go's text/template](https://golang.org/pkg/text/tem

### Variables (beta)

| Var | Desc |
|:--------------:|:------------------------------------:|
| `DialogID` | Telegram dialog id |
| `MessageID` | Telegram message id |
| `MessageDate` | Telegram message date(timestamp) |
| `FileName` | Telegram file name |
| `FileSize` | Human-readable file size, like `1GB` |
| `DownloadDate` | Download date(timestamp) |
| Var | Desc |
|:--------------:|:----------------------------------------:|
| `DialogID` | Telegram dialog id |
| `MessageID` | Telegram message id |
| `MessageDate` | Telegram message date(timestamp) |
| `FileName` | Telegram file name |
| `FileCaption` | Telegram file caption, aka. text message |
| `FileSize` | Human-readable file size, like `1GB` |
| `DownloadDate` | Download date(timestamp) |

### Functions (beta)

Expand Down
17 changes: 9 additions & 8 deletions docs/content/zh/guide/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ bookToC: false

### 变量 (Beta)

| 变量 | 描述 |
|:--------------:|:------------------:|
| `DialogID` | Telegram 对话ID |
| `MessageID` | Telegram 消息ID |
| `MessageDate` | Telegram 消息日期(时间戳) |
| `FileName` | Telegram 文件名 |
| `FileSize` | 可读的文件大小,例如 `1GB` |
| `DownloadDate` | 下载日期(时间戳) |
| 变量 | 描述 |
|:--------------:|:---------------------:|
| `DialogID` | Telegram 对话ID |
| `MessageID` | Telegram 消息ID |
| `MessageDate` | Telegram 消息日期(时间戳) |
| `FileName` | Telegram 文件名 |
| `FileCaption` | Telegram 文件说明,也就是文本消息 |
| `FileSize` | 可读的文件大小,例如 `1GB` |
| `DownloadDate` | 下载日期(时间戳) |

### 函数 (Beta)

Expand Down

0 comments on commit 91b1e17

Please sign in to comment.