Add send animation service to telegram (#41489)

* added telegram sendAnimation api call

Signed-off-by: Tobias Perschon <tobias@perschon.at>

* more accurate service descriptions

Signed-off-by: Tobias Perschon <tobias@perschon.at>

* added 3rd parse_mode to description
This commit is contained in:
Tobias Perschon 2020-12-15 15:20:08 +01:00 committed by GitHub
parent 2765c6f1e9
commit 266f82ac76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 5 deletions

View file

@ -79,6 +79,7 @@ DOMAIN = "telegram_bot"
SERVICE_SEND_MESSAGE = "send_message"
SERVICE_SEND_PHOTO = "send_photo"
SERVICE_SEND_STICKER = "send_sticker"
SERVICE_SEND_ANIMATION = "send_animation"
SERVICE_SEND_VIDEO = "send_video"
SERVICE_SEND_VOICE = "send_voice"
SERVICE_SEND_DOCUMENT = "send_document"
@ -224,6 +225,7 @@ SERVICE_MAP = {
SERVICE_SEND_MESSAGE: SERVICE_SCHEMA_SEND_MESSAGE,
SERVICE_SEND_PHOTO: SERVICE_SCHEMA_SEND_FILE,
SERVICE_SEND_STICKER: SERVICE_SCHEMA_SEND_FILE,
SERVICE_SEND_ANIMATION: SERVICE_SCHEMA_SEND_FILE,
SERVICE_SEND_VIDEO: SERVICE_SCHEMA_SEND_FILE,
SERVICE_SEND_VOICE: SERVICE_SCHEMA_SEND_FILE,
SERVICE_SEND_DOCUMENT: SERVICE_SCHEMA_SEND_FILE,
@ -367,6 +369,7 @@ async def async_setup(hass, config):
elif msgtype in [
SERVICE_SEND_PHOTO,
SERVICE_SEND_STICKER,
SERVICE_SEND_ANIMATION,
SERVICE_SEND_VIDEO,
SERVICE_SEND_VOICE,
SERVICE_SEND_DOCUMENT,
@ -674,6 +677,7 @@ class TelegramNotificationService:
func_send = {
SERVICE_SEND_PHOTO: self.bot.sendPhoto,
SERVICE_SEND_STICKER: self.bot.sendSticker,
SERVICE_SEND_ANIMATION: self.bot.sendAnimation,
SERVICE_SEND_VIDEO: self.bot.sendVideo,
SERVICE_SEND_VOICE: self.bot.sendVoice,
SERVICE_SEND_DOCUMENT: self.bot.sendDocument,

View file

@ -13,7 +13,7 @@ send_message:
description: An array of pre-authorized chat_ids to send the notification to. If not present, first allowed chat_id is the default.
example: "[12345, 67890] or 12345"
parse_mode:
description: "Parser for the message text: `html` or `markdown`."
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
@ -55,6 +55,9 @@ send_photo:
target:
description: An array of pre-authorized chat_ids to send the document to. If not present, first allowed chat_id is the default.
example: "[12345, 67890] or 12345"
parse_mode:
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
example: true
@ -78,10 +81,10 @@ send_sticker:
description: Send a sticker.
fields:
url:
description: Remote path to an webp sticker.
description: Remote path to a static .webp or animated .tgs sticker.
example: "http://example.org/path/to/the/sticker.webp"
file:
description: Local path to an webp sticker.
description: Local path to a static .webp or animated .tgs sticker.
example: "/path/to/the/sticker.webp"
username:
description: Username for a URL which require HTTP basic authentication.
@ -111,6 +114,46 @@ send_sticker:
description: 'Tag for sent message. In telegram_sent event data: {{trigger.event.data.message_tag}}'
example: "msg_to_edit"
send_animation:
description: Send an anmiation.
fields:
url:
description: Remote path to a GIF or H.264/MPEG-4 AVC video without sound.
example: "http://example.org/path/to/the/animation.gif"
file:
description: Local path to a GIF or H.264/MPEG-4 AVC video without sound.
example: "/path/to/the/animation.gif"
caption:
description: The title of the animation.
example: "My animation"
username:
description: Username for a URL which require HTTP basic authentication.
example: myuser
password:
description: Password for a URL which require HTTP basic authentication.
example: myuser_pwd
target:
description: An array of pre-authorized chat_ids to send the document to. If not present, first allowed chat_id is the default.
example: "[12345, 67890] or 12345"
parse_mode:
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
example: true
verify_ssl:
description: Enable or disable SSL certificate verification. Set to false if you're downloading the file from a URL and you don't want to validate the SSL certificate of the server.
example: false
timeout:
description: Timeout for send sticker. Will help with timeout errors (poor internet connection, etc)
example: "1000"
keyboard:
description: List of rows of commands, comma-separated, to make a custom keyboard.
example: '["/command1, /command2", "/command3"]'
inline_keyboard:
description: List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data.
example: '["/button1, /button2", "/button3"] or [[["Text button1", "/button1"], ["Text button2", "/button2"]], [["Text button3", "/button3"]]]'
send_video:
description: Send a video.
fields:
@ -118,7 +161,7 @@ send_video:
description: Remote path to a video.
example: "http://example.org/path/to/the/video.mp4"
file:
description: Local path to an image.
description: Local path to a video.
example: "/path/to/the/video.mp4"
caption:
description: The title of the video.
@ -132,6 +175,9 @@ send_video:
target:
description: An array of pre-authorized chat_ids to send the document to. If not present, first allowed chat_id is the default.
example: "[12345, 67890] or 12345"
parse_mode:
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
example: true
@ -212,6 +258,9 @@ send_document:
target:
description: An array of pre-authorized chat_ids to send the document to. If not present, first allowed chat_id is the default.
example: "[12345, 67890] or 12345"
parse_mode:
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_notification:
description: Sends the message silently. iOS users and Web users will not receive a notification, Android users will receive a notification with no sound.
example: true
@ -275,7 +324,7 @@ edit_message:
description: Optional title for your notification. Will be composed as '%title\n%message'
example: "Your Garage Door Friend"
parse_mode:
description: "Parser for the message text: `html` or `markdown`."
description: "Parser for the message text: `markdownv2`, `html` or `markdown`."
example: "html"
disable_web_page_preview:
description: Disables link previews for links in the message.