docs: update diff format

This commit is contained in:
Bo-Yi Wu 2019-10-19 10:23:22 +08:00
parent f529160760
commit 75ffa6ef7b

156
DOCS.md
View File

@ -1,5 +1,5 @@
---
date: 2017-01-08T00:00:00+00:00
date: 2019-10-19T00:00:00+00:00
title: Telegram
author: appleboy
tags: [ notifications, chat ]
@ -11,7 +11,7 @@ image: appleboy/drone-telegram
The Telegram plugin posts build status messages to your account. The below pipeline configuration demonstrates simple usage:
```yaml
- name: send notification
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
@ -21,122 +21,132 @@ The Telegram plugin posts build status messages to your account. The below pipel
Example configuration with photo message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ photo:
+ - tests/1.png
+ - tests/2.png
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ photo:
+ - tests/1.png
+ - tests/2.png
```
Example configuration with document message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ document:
+ - tests/1.pdf
+ - tests/2.pdf
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ document:
+ - tests/1.pdf
+ - tests/2.pdf
```
Example configuration with sticker message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ sticker:
+ - tests/3.png
+ - tests/4.png
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ sticker:
+ - tests/3.png
+ - tests/4.png
```
Example configuration with audio message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ audio:
+ - tests/audio1.mp3
+ - tests/audio2.mp3
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ audio:
+ - tests/audio1.mp3
+ - tests/audio2.mp3
```
Example configuration with voice message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ voice:
+ - tests/voice1.ogg
+ - tests/voice2.ogg
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ voice:
+ - tests/voice1.ogg
+ - tests/voice2.ogg
```
Example configuration with location message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ location:
+ - 24.9163213,121.1424972
+ - 24.9263213,121.1224972
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ location:
+ - 24.9163213,121.1424972
+ - 24.9263213,121.1224972
```
Example configuration with venue message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ venue:
+ - 24.9163213,121.1424972,title,address
+ - 24.3163213,121.1824972,title,address
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ venue:
+ - 24.9163213,121.1424972,title,address
+ - 24.3163213,121.1824972,title,address
```
Example configuration with video message:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ video:
+ - tests/video1.mp4
+ - tests/video2.mp4
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ video:
+ - tests/video1.mp4
+ - tests/video2.mp4
```
Example configuration with message format:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ format: markdown
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ format: markdown
```
Example configuration with a custom message template:
```diff
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ message: >
+ {{#success build.status}}
+ build {{build.number}} succeeded. Good job.
+ {{else}}
+ build {{build.number}} failed. Fix me please.
+ {{/success}}
- name: send telegram notification
image: appleboy/drone-telegram
settings:
token: xxxxxxxxxx
to: telegram_user_id
+ message: >
+ {{#success build.status}}
+ build {{build.number}} succeeded. Good job.
+ {{else}}
+ build {{build.number}} failed. Fix me please.
+ {{/success}}
```
## Parameter Reference