Repository navigation
feat(bot): reply keyboard in DMs with Play, Today's result and Menu - #96
Merged
Merged
Conversation
In a DM the menu button opens the Mini App, so the command list is hidden and a new player has nothing to press after the first game. A persistent reply keyboard keeps three buttons under the input field. Play opens the day in the Mini App. Today's result reads the DM's zone: before 20:00 it says whether the person has answered and how long until the result (or that an earlier group reveal closed the day); from the reveal it gives the score and the world rank, "so far" while western zones are still answering, with a button into the result. Menu sends the home panel. The keyboard rides on its own short message, since a message has one reply_markup and the panel's is inline. It is sent on /start in a DM and again when the person's language changes. Button texts are matched in all 16 languages before any other text handling and count as nothing else. Groups never get it, and there is no location button: a location in a DM is the day's answer. The telegram client gains a Keyboard type and SendKeyboard; tg needs no release. Refs #95 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #95.
In a DM the menu button opens the Mini App, so the command list is hidden and a new player has nothing to press after the first game. This adds a persistent reply keyboard in DMs:
APP_URLit is a text button that sends the menu).3 500 for 312 km) and world rank, phrased "so far" until the last zone's reveal, plus an Open the result button into the Mini App; without an answer, "No answer from you today."The rank is the same nameless one the Mini App shows after answering.
How it is sent: a message has one
reply_markupand the panel's is inline, so the keyboard rides on its own short line ("The buttons below stay with you…"). It goes out on/startin a DM, before the panel, and again when the person's language changes (picked or Follow Telegram). Groups never get it:sendKeyboardrefuses any non-private chat, and labels typed in a group are ignored.Button texts are matched in all 16 languages (a keyboard drawn before a language change still works) before any other text handling, and count as nothing else. No
request_location(a DM location is the day's answer) and no other request buttons.internal/telegramgainsKeyboard(is_persistent,resize_keyboard,input_field_placeholder) andSendKeyboard; notgrelease. Thebot.Storeinterface gainsGuessOfandWorld, both existingdb.Storemethods. New strings:kb.*,today.*,unit.hm,unit.minin all 16 languages.Tests
TestKeyboardMarkup: the exact JSON sent tosendMessage.TestKeyLabelsAreUnambiguous,TestKeyOfMatchesEveryLanguageInDMsOnly: matching in every language, never in groups or from bots.TestStartSendsTheKeyboardInDMsOnly,TestLanguageChangeResendsTheKeyboard: a group never gets the keyboard, even from a forged language press.TestMenuButtonSendsTheHome,TestTodaysResult,TestTodaysResultAfterTheDeadline.gofmt -l .,go vet ./...andgo test -race ./...pass. Not checked: the integration tests (no PostgreSQL needed for this change) and the keyboard on real iOS, Android and Desktop clients, which the issue's "Done when" asks for.maply-dev's fake Bot API ignores reply keyboards, so it will not show them.Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com