Add pending-action timeouts, persistent menu helpers, group-linking & link normalization, and expand tests - #98
Conversation
…nks, group linking tools, TestAll engine, full navigation hardening, env/doc/detection sync
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
…for-runewager-bot
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR refactors URL/link handling across the bot, introduces menu lifecycle management helpers, adds group linking administration tools, updates environment configuration, and expands test coverage with new smoke and unit tests validating the updated behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Bot
participant PlayLinkResolver as getPlayLink()
participant BrowserLink as Browser
participant TelegramApp as Telegram MiniApp
User->>Bot: Request play action
Bot->>PlayLinkResolver: getPlayLink(user, route)
alt User playMode === 'browser'
PlayLinkResolver->>BrowserLink: getBrowserLink(route)
BrowserLink-->>PlayLinkResolver: External gamble-codez URL
PlayLinkResolver-->>Bot: Browser URL
Bot->>BrowserLink: Redirect user
else User playMode === 'telegram'
PlayLinkResolver->>TelegramApp: getStartAppLink(route)
TelegramApp-->>PlayLinkResolver: Telegram /start?app_url=route
PlayLinkResolver-->>Bot: MiniApp URL
Bot->>TelegramApp: Open MiniApp
end
sequenceDiagram
participant Admin
participant BotUI as Bot Interface
participant SettingsMenu as Settings Handler
participant GroupLinkingTools as Group Linking Tools
participant GroupDB as Group Database
Admin->>BotUI: Tap Settings
BotUI->>SettingsMenu: sendSettingsMenu()
SettingsMenu->>BotUI: Display with settings_group_linking_tools button
Admin->>BotUI: Tap Group Linking Tools
BotUI->>GroupLinkingTools: renderGroupLinkingTools(ctx)
GroupLinkingTools->>GroupDB: Query linked groups
GroupDB-->>GroupLinkingTools: Current groups list
GroupLinkingTools->>BotUI: Display groups with actions (view/remove/test)
alt Admin removes group
Admin->>BotUI: Tap group_link_remove_<id>
BotUI->>GroupDB: Delete group link
GroupDB-->>BotUI: Confirmed
BotUI->>BotUI: Refresh group linking tools view
else Admin tests permissions
Admin->>BotUI: Tap group_link_test_permissions
BotUI->>GroupDB: Validate bot permissions
GroupDB-->>BotUI: Permission status
BotUI->>Admin: Display test results
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Nitpicks 🔍
|
|
CodeAnt AI finished reviewing your PR. |
User description
Motivation
Description
PENDING_ACTION_TIMEOUT_MS,ACTION_LABELS, andevaluatePendingActionTimeout()to normalize and expire pending states while preserving the exact-15-minute boundary semantics.clearOldMenus(),replyMenu()and user fieldslastMenuMsgId/lastMenuChatId, and updatedsendMainMenu()/sendSettingsMenu()//cancelto use them to keep only one active menu per user.unwrapTelegramUrl(),getDiscordLink(),getBrowserLink(),getWebAppLink(),getStartAppLink(), andgetPlayLink()and wiredLINKSto sanitize/normalize Discord and Telegram links and drive deterministic play button behavior.renderGroupLinkingTools()and keyboard definitions.miniAppPlayButton()now respects user play mode and labels, settings keyboard exposes Group Linking Tools, and test giveaway/menu flows usereplyMenu..env.exampleto document new/used env keys (BOT_PRIVACY_MODE/compatBOTPRIVACYMODE,TELEGRAM_*_LINK,HTTPS_CERT_PATH,HTTPS_KEY_PATH,LOG_LEVEL,WEBAPP_HMAC_KEY, etc.).test/smoke.test.jsandtest/unit.test.jsto cover pending-action boundaries, command/callback extraction, catch-all regex handling, env docs, menu/menu-clear behavior, group-linking callbacks, play-link routing, andtestallsummary output.Testing
test/unit.test.jsandtest/smoke.test.js(via the repo test runner); all tests passed..env.exampledocumentation of core runtime vars, andtestallfinal summary formatting, and they succeeded.Codex Task
CodeAnt-AI Description
Add single-active menus, deterministic Play links, Discord/Telegram link normalization, and admin group-linking tools
What Changed
Impact
✅ Clearer Play button behavior for browser vs mini-app users✅ Fewer stale menus shown to users✅ Clearer and safer external Discord/Telegram links💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
New Features
Improvements
Configuration