feat(download): add FileCaption to download template (#560)

* feat(download): add FileCaption to download template

* doc(template.md): add FileCaption description
This commit is contained in:
XMLHexagram 2024-04-18 00:12:49 +08:00 committed by GitHub
parent 51677e6147
commit 91b1e17d1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 16 deletions

View File

@ -31,6 +31,7 @@ type fileTemplate struct {
MessageID int
MessageDate int64
FileName string
FileCaption string
FileSize string
DownloadDate int64
}
@ -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(),
})

View File

@ -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)

View File

@ -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)