mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Improve explanation on how to get API token in Telegram (#147605)
This commit is contained in:
parent
f8207a2e0e
commit
c8422c9fb8
@ -293,10 +293,15 @@ class TelgramBotConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
) -> ConfigFlowResult:
|
) -> ConfigFlowResult:
|
||||||
"""Handle a flow to create a new config entry for a Telegram bot."""
|
"""Handle a flow to create a new config entry for a Telegram bot."""
|
||||||
|
|
||||||
|
description_placeholders: dict[str, str] = {
|
||||||
|
"botfather_username": "@BotFather",
|
||||||
|
"botfather_url": "https://t.me/botfather",
|
||||||
|
}
|
||||||
if not user_input:
|
if not user_input:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=STEP_USER_DATA_SCHEMA,
|
data_schema=STEP_USER_DATA_SCHEMA,
|
||||||
|
description_placeholders=description_placeholders,
|
||||||
)
|
)
|
||||||
|
|
||||||
# prevent duplicates
|
# prevent duplicates
|
||||||
@ -305,7 +310,6 @@ class TelgramBotConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
# validate connection to Telegram API
|
# validate connection to Telegram API
|
||||||
errors: dict[str, str] = {}
|
errors: dict[str, str] = {}
|
||||||
description_placeholders: dict[str, str] = {}
|
|
||||||
bot_name = await self._validate_bot(
|
bot_name = await self._validate_bot(
|
||||||
user_input, errors, description_placeholders
|
user_input, errors, description_placeholders
|
||||||
)
|
)
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
"config": {
|
"config": {
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Telegram bot setup",
|
"description": "To create a Telegram bot, follow these steps:\n\n1. Open Telegram and start a chat with [{botfather_username}]({botfather_url}).\n1. Send the command `/newbot`.\n1. Follow the instructions to create your bot and get your API token.",
|
||||||
"description": "Create a new Telegram bot",
|
|
||||||
"data": {
|
"data": {
|
||||||
"platform": "Platform",
|
"platform": "Platform",
|
||||||
"api_key": "[%key:common::config_flow::data::api_key%]",
|
"api_key": "[%key:common::config_flow::data::api_token%]",
|
||||||
"proxy_url": "Proxy URL"
|
"proxy_url": "Proxy URL"
|
||||||
},
|
},
|
||||||
"data_description": {
|
"data_description": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user