Improve explanation on how to get API token in Telegram (#147605)

This commit is contained in:
Joost Lekkerkerker 2025-06-26 18:21:56 +02:00 committed by Franck Nijhof
parent f8207a2e0e
commit c8422c9fb8
No known key found for this signature in database
GPG Key ID: AB33ADACE7101952
2 changed files with 7 additions and 4 deletions

View File

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

View File

@ -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": {