Repository: home-assistant/core
File: homeassistant/components/telegram/notify.py (Python)

Code before:
    ir.async_create_issue(
        hass,
        DOMAIN,
        "migrate_notify",
        breaks_in_ha_version="2026.5.0",
        is_fixable=False,
        translation_key="migrate_notify",
        severity=ir.IssueSeverity.WARNING,
        learn_more_url="https://www.home-assistant.io/integrations/telegram_bot#notifiers",
    )

    await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
    chat_id = config.get(CONF_CHAT_ID)
    return TelegramNotificationService(hass, chat_id)


class TelegramNotificationService(BaseNotificationService):
    """Implement the notification service for Telegram."""

    def __init__(self, hass, chat_id):
        """Initialize the service."""
        self._chat_id = chat_id
        self.hass = hass

    def send_message(self, message="", **kwargs):
        """Send a message to a user."""
        service_data = {ATTR_TARGET: kwargs.get(ATTR_TARGET, self._chat_id)}
        data = kwargs.get(ATTR_DATA)

        # Set message tag
        if data is not None and ATTR_MESSAGE_TAG in data:
            message_tag = data.get(ATTR_MESSAGE_TAG)
            service_data.update({ATTR_MESSAGE_TAG: message_tag})

        # Set disable_notification
        if data is not None and ATTR_DISABLE_NOTIF in data:
            disable_notification = data.get(ATTR_DISABLE_NOTIF)
            service_data.update({ATTR_DISABLE_NOTIF: disable_notification})

        # Set parse_mode
        if data is not None and ATTR_PARSER in data:
            parse_mode = data.get(ATTR_PARSER)
            service_data.update({ATTR_PARSER: parse_mode})

        # Set disable_web_page_preview
        if data is not None and ATTR_DISABLE_WEB_PREV in data:
            disable_web_page_preview = data[ATTR_DISABLE_WEB_PREV]
            service_data.update({ATTR_DISABLE_WEB_PREV: disable_web_page_preview})

        # Set message_thread_id
        if data is not None and ATTR_MESSAGE_THREAD_ID in data:

Review comment (suggestion):
`send_message` is not expected to return anything.
I've accordingly adjusted a couple of calls below from `return self.hass.services.call` to `self.hass.services.call`+`return`

Code after:

    ir.async_create_issue(
        hass,
        DOMAIN,
        "migrate_notify",
        breaks_in_ha_version="2026.5.0",
        is_fixable=False,
        translation_key="migrate_notify",
        severity=ir.IssueSeverity.WARNING,
        learn_more_url="https://www.home-assistant.io/integrations/telegram_bot#notifiers",
    )

    await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
    chat_id = config.get(CONF_CHAT_ID)
    return TelegramNotificationService(hass, chat_id)


class TelegramNotificationService(BaseNotificationService):
    """Implement the notification service for Telegram."""

    def __init__(self, hass, chat_id):
        """Initialize the service."""
        self._chat_id = chat_id
        self.hass = hass

    def send_message(self, message: str = "", **kwargs: Any) -> None:
        """Send a message to a user."""
        service_data = {ATTR_TARGET: kwargs.get(ATTR_TARGET, self._chat_id)}
        data = kwargs.get(ATTR_DATA)

        # Set message tag
        if data is not None and ATTR_MESSAGE_TAG in data:
            message_tag = data.get(ATTR_MESSAGE_TAG)
            service_data.update({ATTR_MESSAGE_TAG: message_tag})

        # Set disable_notification
        if data is not None and ATTR_DISABLE_NOTIF in data:
            disable_notification = data.get(ATTR_DISABLE_NOTIF)
            service_data.update({ATTR_DISABLE_NOTIF: disable_notification})

        # Set parse_mode
        if data is not None and ATTR_PARSER in data:
            parse_mode = data.get(ATTR_PARSER)
            service_data.update({ATTR_PARSER: parse_mode})

        # Set disable_web_page_preview
        if data is not None and ATTR_DISABLE_WEB_PREV in data:
            disable_web_page_preview = data[ATTR_DISABLE_WEB_PREV]
            service_data.update({ATTR_DISABLE_WEB_PREV: disable_web_page_preview})

        # Set message_thread_id