Skip to content

Promo Manager, Content Drops, Announcements & admin UX refactor - #85

Merged
gamblecodezcom merged 3 commits into
mainfrom
codex/add-new-admin-promo-manager-h573tk
Feb 25, 2026
Merged

Promo Manager, Content Drops, Announcements & admin UX refactor#85
gamblecodezcom merged 3 commits into
mainfrom
codex/add-new-admin-promo-manager-h573tk

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 25, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Replace legacy single promo/code model with a DB-backed Promo Manager to support richer promo workflows, approvals, cooldowns and analytics.
  • Improve broadcast/announcement tooling and content-drop (tips) reliability and targeting for group/channel delivery.
  • Harden admin tooling and SSHV console experience with better error hints, safer editor saves, TLS-aware health checks and housekeeping improvements.
  • Add small infra hygiene updates for .env and .gitignore and expand smoke tests to catch callback mismatches early.

Description

  • Replaced simple promoStore/promoCodeStore with promoManagerStore persisted to data/promo-manager-db.json, added promo schema normalization, list/query helpers, claim records and eligibility evaluation logic.
  • Added admin promo manager flows and UI hooks (create/edit/pause/delete/preview/stats/queue) and commands to approve/deny claims (/pmapprove, /pmdeny), plus legacy mappings to keep old promo commands stable.
  • Reworked user-facing promo flow to list DB-backed promos, evaluate eligibility per-user (wager, new-user/existing, claim limits, cooldowns), record claims and notify admins on pending approvals.
  • Reworked announcements/broadcast flow into an interactive builder with toggleable targets (DM, channel, group), parse-mode toggle, send preview/summary and a consolidated sendAnnouncementTargets implementation.
  • Renamed and extended Tips system to "Content Drops" with robust target-resolution and resilient delivery via postTipToConfiguredTarget, plus /register_chat and /verify_bot_setup helpers and test/send helpers.
  • SSHV and admin console improvements: sandbox restriction hint on failing execs, isHealthTlsEnabled TLS-aware health checks, safer file saves with try/catch and admin logging, added admin logs for ctrl actions, and unref() on GC timers.
  • Misc: add explanatory comment for WEBAPP_HMAC_KEY in .env.example, expand .gitignore to ignore data/*.json and backups, add broadcastConfigStore and minor UX text changes across menus and keyboards.

Testing

  • Ran the smoke suite (test/smoke.test.js) which includes node --check index.js syntax validation and the new callback handler coverage test, and all checks passed.
  • Verified announce builder flow and test tip posting logic via unit-style smoke assertions in test/smoke.test.js (test succeeded).
  • No failing automated tests detected in CI-mode smoke runs; runtime behaviors (broadcasts, promo claim lifecycle, tips scheduler) were covered by the updated smoke validations.

Codex Task


CodeAnt-AI Description

Add interactive Announcements builder, Content Drops delivery improvements, admin UX tweaks, SSHV and health-check hardening, and new smoke test

What Changed

  • Admin announcements: interactive builder lets admins toggle targets (DM, channel, group), switch parse mode, preview, and send; broadcasts report per-target delivery results.
  • Content Drops (formerly "Tips"): renamed labels, new target resolution and fallback so drops post to a configured chat or an approved group, improved test/send feedback, and a /register_chat helper to capture a target by forwarding a message.
  • Persistent menu and labels updated for users and admins (Play, Bonuses & Rewards, Profile & Link, Giveaways & Community, Settings, Admin Control Center) so menu wording and destinations are clearer.
  • SSHV and health-check reliability: TLS-aware health checks, clearer sandbox restriction hint shown on failing shell commands, safer editor saves with error handling and admin logs, and background timers unref'd to avoid keeping process alive.
  • Promo flow fixes: new-user-only promos now honor an explicit user flag and users can mark themselves as having claimed via a "I claimed successfully" button so new-user promos hide correctly.
  • Tests: added a smoke test that verifies index.js syntax and ensures inline callback IDs in menus map to handlers or known dynamic patterns to prevent broken buttons.

Impact

✅ Clearer announce targeting and delivery results
✅ Fewer failed Content Drops due to automatic fallback and registration
✅ Safer admin SSH editor saves with actionable error hints

💡 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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 Sourcery

Update Telegram targets configuration, refine new-user promo handling, and rebrand the Tips system to Content Drops in admin flows and messaging.

New Features:

  • Allow users to explicitly mark that they have successfully claimed a promo so new-user-only promos are hidden going forward.

Bug Fixes:

  • Ensure new-user-only promos correctly treat users as ineligible once they have either redeemed any promo or been marked as having claimed a new-user promo.

Enhancements:

  • Make Telegram channel and group links and IDs configurable via environment variables instead of hard-coded values.
  • Rename the Tips system to Content Drops across admin menus, dashboards, commands, and help text for clearer terminology.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added dedicated button for users to claim new-user promotions with automatic tracking.
  • Updates

    • Rebranded "Tips" to "Content Drops" throughout the user interface, including commands, menus, and admin panels.
    • Updated help documentation, command references, and dashboard labels to reflect the new naming scheme.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

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 ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:XL This PR changes 500-999 lines, ignoring generated files label Feb 25, 2026
@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Single-file assumption
    The test reads only index.js for callback/button definitions and handlers. If callbacks or handlers are defined in other source files or generated at runtime, they won't be discovered and the test will report uncovered handlers incorrectly.

  • Incomplete dynamic patterns
    The dynamicPatterns array enumerates expected dynamic callback prefixes. New or slightly different dynamic naming schemes (additional prefixes, suffixes, or different separators) will not be covered and may make the test fail even though handlers exist. Consider making patterns more permissive or centralizing pattern definitions with the code that emits those callbacks.

  • Regex limitation
    The test's regexes only match single-quoted callback/action string literals. If callback IDs or action names are defined with double quotes or backticks, or contain escaped quotes, they will be missed and produce false positives in the uncovered list.

@gamblecodezcom
gamblecodezcom merged commit fa22618 into main Feb 25, 2026
1 check passed
@gamblecodezcom
gamblecodezcom deleted the codex/add-new-admin-promo-manager-h573tk branch February 25, 2026 09:53
@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gamblecodezcom has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 33 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 50123f8 and 460a908.

📒 Files selected for processing (1)
  • index.js
📝 Walkthrough

Walkthrough

The PR updates the Telegram bot's configuration to introduce environment-driven channel and group identifiers, rebrand "Tips" terminology to "Content Drops" throughout UI and commands, add a new user state flag for tracking new-user promo claims, and update admin interfaces and promo eligibility logic accordingly.

Changes

Cohort / File(s) Summary
Configuration & Environment Variables
index.js (config section)
Added TELEGRAM_CHANNEL_LINK, TELEGRAM_GROUP_LINK env vars and corresponding TELEGRAM_CHANNEL_ID, TELEGRAM_GROUP_ID constants; updated LINKS object to use these env-driven values instead of hard-coded strings.
Tips to Content Drops Rebranding
index.js (UI labels, commands, help text)
Replaced "Tips" terminology with "Content Drops" across command handlers, admin keyboard layouts, help pages, and user-facing messages (e.g., "Tips Manager" → "Content Drops Manager", /tiplist output, dashboard text).
Promo Claim Flow & User State
index.js (promo logic, eligibility, and claim handling)
Added hasClaimedNewUserPromo flag initialization and propagation; updated promo eligibility evaluation to treat new-user promo as claimed when flag is true; introduced UI button for claiming promo ("✅ I claimed successfully") that sets the flag and updates claim timing.
Admin UI & Command Updates
index.js (admin keyboard, status messages)
Updated admin command labels, keyboard layouts, and status messages to reflect "Content Drops" terminology and align with TELEGRAM_CHANNEL_ID/TELEGRAM_GROUP_ID for targeting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size:M

Poem

🐰 Content drops hop into place,
New claims bloom with user grace,
Tips rebranded, configs align,
Admin buttons shine so fine!
Changes bounce with purpose bright,
The bot now flows just right!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-new-admin-promo-manager-h573tk

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@gamblecodezcom

Copy link
Copy Markdown
Owner Author

@sourcery-ai

@sourcery-ai

sourcery-ai Bot commented Feb 27, 2026

Copy link
Copy Markdown

Sure! I'm generating a new review now.

@gamblecodezcom

Copy link
Copy Markdown
Owner Author

@sourcery-ai review my full main branch for Runewager repo. Send full need fixed list, list all bugs, list all your recommendations to improve user experience and admin.

@sourcery-ai

sourcery-ai Bot commented Feb 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

Refactors promo and content delivery UX by tightening new-user promo eligibility tracking, rebranding the Tips system into Content Drops with clearer admin wording, and making Telegram targets configurable via environment variables, while adding a small UX affordance for users to mark new-user promos as claimed.

Sequence diagram for new-user promo claim and eligibility tracking

sequenceDiagram
  actor User
  participant TelegramBot
  participant UserStore
  participant PromoMenu
  participant PromoEngine

  User->>TelegramBot: tap menu_claim_bonus
  TelegramBot->>UserStore: getUser(ctx)
  UserStore-->>TelegramBot: user(hasClaimedNewUserPromo=false/true)
  TelegramBot->>PromoEngine: evaluatePromoEligibility(user,promo,logFailure)
  PromoEngine->>PromoEngine: hasRedeemedAnyPromo(user.id)
  PromoEngine->>PromoEngine: check promo.new_user_only && (anyRedeemed || user.hasClaimedNewUserPromo)
  PromoEngine-->>TelegramBot: eligiblePromos list
  TelegramBot->>PromoMenu: build promo buttons + I_claimed_successfully
  PromoMenu-->>User: Promo Menu with eligible promos

  User->>TelegramBot: tap promo_user_claimed_successfully
  TelegramBot->>UserStore: getUser(ctx)
  UserStore-->>TelegramBot: user
  TelegramBot->>UserStore: set user.hasClaimedNewUserPromo=true
  TelegramBot->>UserStore: set user.lastAnyPromoClaimAt=now
  TelegramBot-->>User: answerCbQuery Saved
  TelegramBot-->>User: reply marked as already claimed

  User->>TelegramBot: tap menu_claim_bonus (later)
  TelegramBot->>UserStore: getUser(ctx)
  UserStore-->>TelegramBot: user(hasClaimedNewUserPromo=true)
  TelegramBot->>PromoEngine: evaluatePromoEligibility(user,promo,logFailure)
  PromoEngine->>PromoEngine: reject new_user_only promos when user.hasClaimedNewUserPromo
  PromoEngine-->>TelegramBot: eligiblePromos (new-user promos hidden)
  TelegramBot-->>User: updated Promo Menu
Loading

Class diagram for user and promo eligibility structures

classDiagram

  class User {
    number id
    boolean hasClaimedNewUserPromo
    number claimedPromoAt
    number lastAnyPromoClaimAt
    Array claimedPromoCodes
    boolean claimedPromo
  }

  class Promo {
    number promo_id
    string name
    boolean new_user_only
    boolean existing_user_only
    PROMO_REQUIREMENT requirement_type
    number required_wager_days
  }

  class PromoRequirementEnum {
    string EXISTING_USER_WITH_WAGER
    string OTHER
  }

  class PromoEngine {
    evaluatePromoEligibility(user,promo,logFailure)
    hasRedeemedAnyPromo(userId)
    getRollingWagerForUser(user,days)
  }

  class MenuHandlers {
    menu_claim_bonus(ctx)
    promo_user_claimed_successfully(ctx)
  }

  User "1" --> "*" Promo : mayBeEligibleFor
  PromoRequirementEnum <|-- Promo : uses
  PromoEngine ..> User : readsFlags
  PromoEngine ..> Promo : evaluates
  MenuHandlers ..> User : uses
  MenuHandlers ..> PromoEngine : calls
Loading

File-Level Changes

Change Details Files
Make Telegram channel/group links and IDs configurable via environment variables for announcements and Content Drops targets.
  • Replace hard-coded GambleCodez channel and group URLs with LINK entries that prefer TELEGRAM_CHANNEL_LINK and TELEGRAM_GROUP_LINK env vars with existing URLs as fallback.
  • Introduce TELEGRAM_CHANNEL_ID and TELEGRAM_GROUP_ID environment-backed IDs and wire ANNOUNCE_CHANNEL to TELEGRAM_CHANNEL_ID.
  • Update TIPS_GROUP resolution to prioritize TIPS_GROUP, then TELEGRAM_GROUP_ID, then empty string to represent unset.
index.js
Tighten new-user promo eligibility by tracking explicit user-claimed state and exposing a UI affordance to set it.
  • Initialize hasClaimedNewUserPromo flag on user objects with a default of false in getUser.
  • Update evaluatePromoEligibility to treat either any prior promo redemption or hasClaimedNewUserPromo as disqualifying for new_user_only promos.
  • Add an inline keyboard button in the promo menu allowing users to mark that they successfully claimed a promo, which sets hasClaimedNewUserPromo and lastAnyPromoClaimAt, acknowledges via callback, and informs the user that new-user promos will now be hidden.
index.js
Rebrand the Tips system to "Content Drops" in admin menus, help text, and settings messaging.
  • Rename admin buttons and labels from Tips Manager to Content Drops in the Promo Manager, admin system tools, and Admin main menu keyboards.
  • Update help pages and tip-related bot responses so headings and settings text consistently refer to Content Drops instead of Tips while keeping command names the same.
  • Adjust tips-related feedback messages (add, edit, list, toggle, settings, remove) to use Drop/Content Drops terminology to match the new branding.
index.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new TELEGRAM_* environment variable fallbacks (especially when TELEGRAM_CHANNEL_ID, TELEGRAM_GROUP_ID, or TIPS_GROUP resolve to an empty string) could benefit from a centralized startup validation or explicit runtime checks so that broadcasts/content drops fail fast with a clear admin-facing error instead of silently using an invalid target.
  • For the promo_user_claimed_successfully flow, consider only showing the button when at least one new-user-only promo exists (or adding a confirmation step) to reduce the risk of users accidentally setting hasClaimedNewUserPromo and hiding legitimate future promos.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new TELEGRAM_* environment variable fallbacks (especially when `TELEGRAM_CHANNEL_ID`, `TELEGRAM_GROUP_ID`, or `TIPS_GROUP` resolve to an empty string) could benefit from a centralized startup validation or explicit runtime checks so that broadcasts/content drops fail fast with a clear admin-facing error instead of silently using an invalid target.
- For the `promo_user_claimed_successfully` flow, consider only showing the button when at least one new-user-only promo exists (or adding a confirmation step) to reduce the risk of users accidentally setting `hasClaimedNewUserPromo` and hiding legitimate future promos.

## Individual Comments

### Comment 1
<location path="index.js" line_range="5206-5211" />
<code_context>
   await ctx.reply(`🎁 *Promo Menu*\n\nOnly promos you are eligible for are shown below.`, { parse_mode: 'Markdown', ...Markup.inlineKeyboard(rows) });
 });

+bot.action('promo_user_claimed_successfully', async (ctx) => {
+  const user = getUser(ctx);
+  user.hasClaimedNewUserPromo = true;
+  user.lastAnyPromoClaimAt = Date.now();
+  await ctx.answerCbQuery('Saved');
+  await ctx.reply('✅ Got it — you are marked as already claimed. New-user-only promos are now hidden for your account.');
+});
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Marking `hasClaimedNewUserPromo` and `lastAnyPromoClaimAt` is not persisted, so state is lost on process restart.

This handler mutates `user.hasClaimedNewUserPromo` and `user.lastAnyPromoClaimAt` but, unlike other user updates (e.g. promo creation, tips settings), it doesn’t call the central persistence mechanism (e.g. `persistRuntimeState()`). If `getUser(ctx)` returns an in-memory object, these flags will be reset on restart and users can see new-user promos again. Please persist the user after updating these fields so the “claimed successfully” state survives restarts.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread index.js
Comment on lines +5206 to +5211
bot.action('promo_user_claimed_successfully', async (ctx) => {
const user = getUser(ctx);
user.hasClaimedNewUserPromo = true;
user.lastAnyPromoClaimAt = Date.now();
await ctx.answerCbQuery('Saved');
await ctx.reply('✅ Got it — you are marked as already claimed. New-user-only promos are now hidden for your account.');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Marking hasClaimedNewUserPromo and lastAnyPromoClaimAt is not persisted, so state is lost on process restart.

This handler mutates user.hasClaimedNewUserPromo and user.lastAnyPromoClaimAt but, unlike other user updates (e.g. promo creation, tips settings), it doesn’t call the central persistence mechanism (e.g. persistRuntimeState()). If getUser(ctx) returns an in-memory object, these flags will be reset on restart and users can see new-user promos again. Please persist the user after updating these fields so the “claimed successfully” state survives restarts.

@sourcery-ai

sourcery-ai Bot commented Feb 27, 2026

Copy link
Copy Markdown

Hey @gamblecodezcom, I've posted a new review for you!

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new promo_user_claimed_successfully flow unconditionally adds the button to the promo menu; consider only rendering it when the user is actually seeing (or has recently seen) a new-user-only promo to avoid confusion for users who have never interacted with such promos.
  • The announcement/content-drop targeting config now mixes TELEGRAM_CHANNEL_ID, TELEGRAM_GROUP_ID, TIPS_GROUP, ANNOUNCE_CHANNEL, and broadcastConfigStore.target*; it may be worth centralizing this into a single configuration helper to make precedence and expected formats (ID vs @username vs URL) explicit and avoid subtle misconfiguration when some env vars are unset.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `promo_user_claimed_successfully` flow unconditionally adds the button to the promo menu; consider only rendering it when the user is actually seeing (or has recently seen) a new-user-only promo to avoid confusion for users who have never interacted with such promos.
- The announcement/content-drop targeting config now mixes `TELEGRAM_CHANNEL_ID`, `TELEGRAM_GROUP_ID`, `TIPS_GROUP`, `ANNOUNCE_CHANNEL`, and `broadcastConfigStore.target*`; it may be worth centralizing this into a single configuration helper to make precedence and expected formats (ID vs @username vs URL) explicit and avoid subtle misconfiguration when some env vars are unset.

## Individual Comments

### Comment 1
<location path="index.js" line_range="54-59" />
<code_context>

 // Channel username (or chat_id) for admin announcements via /announce
-const ANNOUNCE_CHANNEL = process.env.ANNOUNCE_CHANNEL || '@GambleCodezDrops';
+const TELEGRAM_CHANNEL_ID = process.env.TELEGRAM_CHANNEL_ID || process.env.ANNOUNCE_CHANNEL || '';
+const TELEGRAM_GROUP_ID = process.env.TELEGRAM_GROUP_ID || '';
+const ANNOUNCE_CHANNEL = TELEGRAM_CHANNEL_ID;

-// Group username (or chat_id) for automatic silent tips
-const TIPS_GROUP = process.env.TIPS_GROUP || '@GambleCodezPrizeHub';
+// Group chat_id for automatic Content Drops
+const TIPS_GROUP = process.env.TIPS_GROUP || TELEGRAM_GROUP_ID || '';

 // ── Images ─────────────────────────────────────────────────────────────────
</code_context>
<issue_to_address>
**issue (bug_risk):** Empty defaults for TELEGRAM_CHANNEL_ID / TIPS_GROUP may silently disable broadcasts/drops.

These env vars used to have non-empty defaults (`@GambleCodezDrops`, `@GambleCodezPrizeHub`), but now can be `''` if unset. If callers don’t explicitly check for non-empty IDs, broadcasts/drops may silently no-op instead of failing visibly. Consider either failing fast when these are missing (throw / prominent log) or retaining a non-empty default to avoid silent misconfiguration.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread index.js
Comment on lines +54 to +59
const TELEGRAM_CHANNEL_ID = process.env.TELEGRAM_CHANNEL_ID || process.env.ANNOUNCE_CHANNEL || '';
const TELEGRAM_GROUP_ID = process.env.TELEGRAM_GROUP_ID || '';
const ANNOUNCE_CHANNEL = TELEGRAM_CHANNEL_ID;

// Group username (or chat_id) for automatic silent tips
const TIPS_GROUP = process.env.TIPS_GROUP || '@GambleCodezPrizeHub';
// Group chat_id for automatic Content Drops
const TIPS_GROUP = process.env.TIPS_GROUP || TELEGRAM_GROUP_ID || '';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Empty defaults for TELEGRAM_CHANNEL_ID / TIPS_GROUP may silently disable broadcasts/drops.

These env vars used to have non-empty defaults (@GambleCodezDrops, @GambleCodezPrizeHub), but now can be '' if unset. If callers don’t explicitly check for non-empty IDs, broadcasts/drops may silently no-op instead of failing visibly. Consider either failing fast when these are missing (throw / prominent log) or retaining a non-empty default to avoid silent misconfiguration.

@gamblecodezcom

Copy link
Copy Markdown
Owner Author

@sourcery-ai You are the senior QA + architecture reviewer for the Runewager repo (main branch). Do a full-stack audit, not just style or diff review.

Your job:

  • Map the entire bot surface: commands, buttons, menus, callbacks, onboarding flows, admin tools, giveaways, status panels, health checks, etc.
  • Identify every place where something can be clicked, tapped, or triggered (Telegram/Discord commands, inline buttons, menus, links, scheduled jobs, web endpoints).
  • For each action, verify:
    • Does it still exist in code?
    • Does it have a working handler wired up?
    • Does it have a clear success path?
    • Does it have a fallback / error path that actually runs?
    • Does it log enough context to debug failures?

Hunt specifically for:

  • Dead buttons: UI elements that exist in messages/menus but have no handler, wrong callback data, or broken routing.
  • Stale menus: options that reference removed features, old copy, or deprecated flows.
  • Orphaned commands: commands defined in help/menus but not implemented, or implemented but never reachable.
  • Missing fallbacks: flows where a failure, invalid state, or missing data leads to a silent no-op, crash, or user confusion instead of a clear error message and safe return path.
  • One-way doors: flows that trap the user with no “back”, “cancel”, or “home” option.
  • State leaks: places where user/session state is set but never cleared, or where a partial flow can leave the user in a broken state.
  • Hard-coded assumptions: IDs, channels, roles, or environment-specific values that will break in other deployments.
  • Logging gaps: critical flows with no logs, or logs that are too vague to debug real incidents.
  • Security/abuse edges: commands or buttons that can be spammed, escalated, or misused due to missing checks.

Deliverables:

  • A structured list of issues grouped by severity:
    • Critical (breaks core flows, money, onboarding, or admin control)
    • High (user-visible bugs, broken buttons, missing fallbacks)
    • Medium/Low (stale copy, confusing UX, weak logging, minor inconsistencies)
  • For each issue:
    • File + function + line range
    • What the user/admin would experience
    • Root cause (wiring, logic, missing handler, stale config, etc.)
    • A concrete, implementation-ready fix suggestion (not just “improve this”).
  • A short “map of the product” summary: what the main flows are, where the rough edges are, and which subsystems need a deeper refactor.

Bias toward:

  • Finding real breakage in flows over nitpicking style.
  • Surfacing anything that would confuse a real user, admin, or operator.
  • Calling out missing fallbacks and dead UI as top priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant