Skip to content

Add /city — set the prayer location by name (groups + desktop fix) - #72

Merged
escalopa merged 1 commit into
mainfrom
feat/city-command
Aug 3, 2026
Merged

Add /city — set the prayer location by name (groups + desktop fix)#72
escalopa merged 1 commit into
mainfrom
feat/city-command

Conversation

@escalopa

@escalopa escalopa commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Why

Telegram renders the share-location button only in private chats, and Telegram Desktop can't attach a location at all — so a group (or a desktop-only user) had no reasonable way to configure the bot. This was the gap we discussed; option 1 (city-name lookup) won.

What

New /city <name> command, available in both private and group chats (admin-gated in groups via the existing canConfigure check):

  1. /city Istanbul → forward-geocode via the Google Geocoding API (same key, localized to the chat language)
  2. Up to 5 matches appear as inline buttons (+ Close)
  3. Tapping one retires the picker and saves through the exact same path as a shared location: resolve timezone/place, round to 3 decimals, keep existing method/madhab/adjustments, bump profile version, rebuild reminders

/city with no argument shows a localized usage hint; an unknown name gets a "try adding the country" reply.

Implementation

  • port.LocationResolver gains Search(ctx, query, language); implemented in the Google Maps adapter (ZERO_RESULTS → empty slice, not an error)
  • New domain.LocationCandidate DTO (label + coordinates only)
  • handleLocation's persistence block extracted into saveLocation, now shared by location messages and city picks — no behavior change for the existing flow
  • Callback data is city:<lat>:<lng> with 3-decimal rounding — fits the 64-byte limit, no server-side picker state
  • /city registered in the Telegram command menu (12 commands now); location_group dead-end message now suggests /city in all 8 locales
  • New i18n keys (city_usage, city_no_results, city_choose) ×8 locales, enforced by the completeness test

Privacy

Nothing new is stored: the chosen coordinates are a public city center, rounded to 3 decimals like every location write; Place ID only, no formatted address.

Tests

  • Adapter: Search happy path (query/language params, label+coords parsing) and ZERO_RESULTS
  • botprofile command-count test updated 11→12
  • i18n completeness + docs (request-flows.md) updated in-PR
  • make check green (17 packages)

🤖 Generated with Claude Code

Telegram offers no share-location button in group chats and none at all
on Desktop, which made groups effectively unconfigurable from there. /city
<name> forward-geocodes the typed place (Google Geocoding, localized),
offers up to five matches as inline buttons, and funnels the pick through
the same saveLocation path as a shared location. Admin-gated in groups;
callback carries only rounded coordinates, so no picker state is stored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@escalopa
escalopa merged commit 03d883c into main Aug 3, 2026
4 checks passed
@escalopa
escalopa deleted the feat/city-command branch August 16, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant