feat: admin menu fix, onboarding gate, intro message, /announce command - #60
Conversation
- Fix: pamenu_back_user now explicitly deletes the admin menu message
and clears its keyboard before rendering the user menu, so admin UI
fully vanishes when tapping Back to User Menu
- Fix: /start no longer skips onboarding — main menu is gated behind
onboarding completion (getNextOnboardingStep >= 5). Returns the
appropriate step prompt (account setup, username link, promo, community)
instead of jumping straight to the main menu
- Add: sexy Runewager intro message sent on /start after the greeting,
auto-deletes after 15 seconds
- Add: showOnboardingPrompt() helper routes to the correct step UI
- Add: /A, /a, /announce commands (admin-only) with a 3-state machine:
await_announcement_text → preview → await_announcement_action
announce_edit → back to text input
announce_send_all → broadcast to all users + @GambleCodezDrops channel
announce_send_channel → channel only
- Add: ANNOUNCE_CHANNEL constant (env ANNOUNCE_CHANNEL or @GambleCodezDrops)
https://claude.ai/code/session_01X3PxGFF5zzKptQwVkjYzzN
|
CodeAnt AI is reviewing your PR. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes introduce an admin announcement workflow enabling broadcast messages to users and a dedicated channel, alongside a revamped onboarding flow with sequential step-based prompts and an introductory message. New admin commands (/A, /a, /announce) surface the announcement functionality within a state-driven flow. Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as Admin User
participant Bot as Bot
participant State as State Manager
participant Users as User Database
Admin->>Bot: /announce command
Bot->>State: Set state: await_announcement_text
State-->>Bot: State updated
Bot-->>Admin: Prompt for announcement text
Admin->>Bot: Send announcement text
Bot->>State: Store announcement text
State-->>Bot: Text stored
Bot-->>Admin: Show edit/send options
alt Admin edits
Admin->>Bot: announce_edit command
Bot->>State: Set state: await_announcement_text
Bot-->>Admin: Prompt for new text
else Admin sends to all
Admin->>Bot: announce_send_all
Bot->>Users: Broadcast to non-opted-out users
Bot->>Bot: Send to ANNOUNCE_CHANNEL
Bot-->>Admin: Confirm broadcast (adminLog)
else Admin sends to channel only
Admin->>Bot: announce_send_channel
Bot->>Bot: Send to ANNOUNCE_CHANNEL only
Bot-->>Admin: Confirm sent (adminLog)
end
sequenceDiagram
participant User as User
participant Bot as Bot
participant State as State Manager
participant UI as UI Renderer
User->>Bot: /start command
Bot->>State: Check age verification
State-->>Bot: Age verified
Bot->>UI: Display introRunewager message
UI-->>Bot: Auto-delete after 15 seconds
Bot->>State: Set onboarding_step = 1
State-->>Bot: State updated
Bot->>UI: Show onboarding prompt (step 1)
UI-->>User: Display step-specific prompt
loop Onboarding Steps 2–4
User->>Bot: Respond to prompt
Bot->>State: Increment onboarding_step
State-->>Bot: Step updated
Bot->>UI: Show next onboarding prompt
UI-->>User: Display step N prompt
end
User->>Bot: Complete step 4
Bot->>State: Mark onboarding_complete = true
State-->>Bot: Onboarding complete
Bot->>UI: Display persistent user main menu
UI-->>User: Show main menu
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
| switch (step) { | ||
| case 1: | ||
| // Account setup — leads through GambleCodez VIP / Discord signup flow | ||
| await sendGambleCodezVIPStep(ctx, user); |
There was a problem hiding this comment.
Suggestion: The new onboarding gate can be bypassed for users whose next step is "Account Setup" because showOnboardingPrompt calls sendGambleCodezVIPStep, which immediately shows the main menu when user.sawGambleCodezStep is true, so users who have seen that screen once can still reach the main menu even if other onboarding steps (verification, linking, promo, community) are incomplete. Resetting sawGambleCodezStep in the gated path ensures they see the intended step UI instead of skipping straight to the menu. [logic error]
Severity Level: Major ⚠️
- ⚠️ /start skips account-setup copy for partially-onboarded users.
- ⚠️ Onboarding step label disagrees with actual UI shown.
- ⚠️ Users may miss GambleCodez VIP signup instructions.| await sendGambleCodezVIPStep(ctx, user); | |
| // In the gated onboarding flow we must not skip straight to the main menu, | |
| // so ensure the VIP step is actually shown even if it was seen before. | |
| user.sawGambleCodezStep = false; |
Steps of Reproduction ✅
1. In `index.js:1661-1760` trigger the age gate and VIP step: send `/start`, tap "✅ I am
18+" (`age_yes` handler at `index.js:2115`), then tap "➡️ Continue — Sign Up with
GambleCodez" (`onboard_gcz_continue` at `index.js:2143`), which sets
`user.sawGambleCodezStep = true` and calls `sendPersistentUserMenu(ctx, user)`.
2. Ensure the user has not completed onboarding: `user.verified === false`,
`user.runewagerUsername` empty, `user.claimedPromo === false`, `user.hasJoinedChannel ===
false`, `user.hasJoinedGroup === false`, so `getNextOnboardingStep(user)` at
`index.js:1214-1223` still returns `1` ("Account Setup").
3. Call `/start` again; in the `/start` handler at `index.js:1765-1867`, after intro
messages it computes `nextOnboardStep = getNextOnboardingStep(user)` (value `1`), sees `<
5`, then sends the auto-deleting "Your next step: Account Setup" message and calls `await
showOnboardingPrompt(ctx, user, nextOnboardStep)` at `index.js:1852-1861`.
4. Inside `showOnboardingPrompt` (current code at `index.js:1302-1345`), case `1` calls
`sendGambleCodezVIPStep(ctx, user)`; in that helper at `index.js:2193-2211` the first line
`if (user.sawGambleCodezStep) { await sendPersistentUserMenu(ctx, user); return; }`
short-circuits, so the user is taken straight to the main menu instead of seeing the
account-setup step UI, despite `/start` detecting that onboarding is still at step 1.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** index.js
**Line:** 1306:1306
**Comment:**
*Logic Error: The new onboarding gate can be bypassed for users whose next step is "Account Setup" because `showOnboardingPrompt` calls `sendGambleCodezVIPStep`, which immediately shows the main menu when `user.sawGambleCodezStep` is true, so users who have seen that screen once can still reach the main menu even if other onboarding steps (verification, linking, promo, community) are incomplete. Resetting `sawGambleCodezStep` in the gated path ensures they see the intended step UI instead of skipping straight to the menu.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
CodeAnt AI finished reviewing your PR. |
User description
https://claude.ai/code/session_01X3PxGFF5zzKptQwVkjYzzN
CodeAnt-AI Description
Require onboarding before main menu, fully hide admin menu on return, add admin /announce and auto-deleting Runewager intro
What Changed
Impact
✅ Clearer onboarding prompts✅ Fewer lingering admin menus visible to users✅ Easier admin broadcast announcements💡 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
/A,/a,/announce) to broadcast messages to users and designated channels.