Allow removing Telegram reply keyboard (#23467)
* Allow removing telegram reply keyboard by setting `keyboard` to an empty list * Telegram keyboard: [] clearing in services.yaml
This commit is contained in:
parent
f434e24252
commit
7331eb1f71
2 changed files with 8 additions and 4 deletions
|
@ -446,11 +446,15 @@ class TelegramNotificationService:
|
|||
params[ATTR_REPLY_TO_MSGID] = data[ATTR_REPLY_TO_MSGID]
|
||||
# Keyboards:
|
||||
if ATTR_KEYBOARD in data:
|
||||
from telegram import ReplyKeyboardMarkup
|
||||
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove
|
||||
keys = data.get(ATTR_KEYBOARD)
|
||||
keys = keys if isinstance(keys, list) else [keys]
|
||||
if keys:
|
||||
params[ATTR_REPLYMARKUP] = ReplyKeyboardMarkup(
|
||||
[[key.strip() for key in row.split(",")] for row in keys])
|
||||
[[key.strip() for key in row.split(",")]
|
||||
for row in keys])
|
||||
else:
|
||||
params[ATTR_REPLYMARKUP] = ReplyKeyboardRemove(True)
|
||||
elif ATTR_KEYBOARD_INLINE in data:
|
||||
from telegram import InlineKeyboardMarkup
|
||||
keys = data.get(ATTR_KEYBOARD_INLINE)
|
||||
|
|
|
@ -22,7 +22,7 @@ send_message:
|
|||
description: Disables link previews for links in the message.
|
||||
example: true
|
||||
keyboard:
|
||||
description: List of rows of commands, comma-separated, to make a custom keyboard.
|
||||
description: List of rows of commands, comma-separated, to make a custom keyboard. Empty list clears a previously set 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.
|
||||
|
|
Loading…
Add table
Reference in a new issue