Skip to content

Commit 5d13a41

Browse files
maxmichelsjbouwh
andauthored
Move telegram-bot URLs out of strings.json (home-assistant#155130)
Co-authored-by: Jan Bouwhuis <[email protected]> Co-authored-by: jbouwh <[email protected]>
1 parent 630b40f commit 5d13a41

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

homeassistant/components/telegram_bot/config_flow.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464

6565
_LOGGER = logging.getLogger(__name__)
6666

67+
DESCRIPTION_PLACEHOLDERS: dict[str, str] = {
68+
"botfather_username": "@BotFather",
69+
"botfather_url": "https://t.me/botfather",
70+
"socks_url": "socks5://username:password@proxy_ip:proxy_port",
71+
}
72+
6773
STEP_USER_DATA_SCHEMA: vol.Schema = vol.Schema(
6874
{
6975
vol.Required(CONF_PLATFORM): SelectSelector(
@@ -310,10 +316,7 @@ async def async_step_user(
310316
) -> ConfigFlowResult:
311317
"""Handle a flow to create a new config entry for a Telegram bot."""
312318

313-
description_placeholders: dict[str, str] = {
314-
"botfather_username": "@BotFather",
315-
"botfather_url": "https://t.me/botfather",
316-
}
319+
description_placeholders: dict[str, str] = DESCRIPTION_PLACEHOLDERS.copy()
317320
if not user_input:
318321
return self.async_show_form(
319322
step_id="user",
@@ -552,13 +555,14 @@ async def async_step_reconfigure(
552555
},
553556
},
554557
),
558+
description_placeholders=DESCRIPTION_PLACEHOLDERS,
555559
)
556560
user_input[CONF_PROXY_URL] = user_input[SECTION_ADVANCED_SETTINGS].get(
557561
CONF_PROXY_URL
558562
)
559563

560564
errors: dict[str, str] = {}
561-
description_placeholders: dict[str, str] = {}
565+
description_placeholders: dict[str, str] = DESCRIPTION_PLACEHOLDERS.copy()
562566

563567
user_input[CONF_API_KEY] = api_key
564568
bot_name = await self._validate_bot(

homeassistant/components/telegram_bot/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"proxy_url": "Proxy URL"
6161
},
6262
"data_description": {
63-
"proxy_url": "Proxy URL if working behind one, optionally including username and password.\n(socks5://username:password@proxy_ip:proxy_port)"
63+
"proxy_url": "Proxy URL if working behind one, optionally including username and password.\n({socks_url})"
6464
},
6565
"name": "Advanced settings"
6666
}

0 commit comments

Comments
 (0)