Release Notes
โจ CoinForge Changelog
All updates and improvements to the bot.
๐ฐ Gambling Balance Fix
- Bet (/bet) exploit fixed: lose-half changed to lose-full. Previously had +25% expected value per round โ infinite money generator removed
- Slots payout rebalanced: 2-match multiplier reduced from 2x to 1.5x. Game now has a proper 8% house edge instead of +16% player edge
- Global max bet cap of 1,000,000 coins enforced server-side on all gambling commands (gamble, coinflip, slots, dice, bet, duel, blackjack)
- Prefix commands now respect the max bet cap (previously only Discord slash-command options had a client-side limit of 1 trillion)
๐ Website Bug Fixes
- Status page 'Most Used Commands' now renders โ fixed block-scoped const bug that silently threw ReferenceError on every refresh
- FAQ search filter now hides category headings when all items filtered (was using closest('h3') instead of previousElementSibling)
- Admin feedback page now requires authentication (owner ID or API key) instead of being publicly accessible
- Top.gg webhook body parsing fixed for Buffer payloads from express.raw() middleware
- Missing CSS variables --accent and --glass added to root stylesheet
- Health check endpoint moved before rate limiter so monitoring tools aren't blocked
- EADDRINUSE retry loop now capped at 5 attempts instead of retrying forever
๐ง Bug Fixes
- Claim interest messageBonus now correctly routes through the premium check branch
- Delete clan logs activity before deleting instead of after (was logging into deleted clan)
- Create clan now locks membership check inside the same transaction as creation
- first_coin achievement now checks balance delta correctly instead of one-off threshold
- setPremium uses greatest() to extend premium_until only forward (never shortens)
- Prefix command handler reuses cached settings for maintenance mode check instead of fresh DB read
- parseDurationPref returns null instead of throwing on invalid duration input
- Remind command handles null guild gracefully for DMs
๐ Website Overhaul
- FAQ page completely rewritten with 27 questions across 7 categories and live search
- Support page expanded with quick start guide, common issues troubleshooting, and resource links
- Docs page expanded with 22 sections including Cooldowns, Crime & Heists, Chat Rewards, Tips & Best Practices, Admin Commands
โฐ Reminders System
- New /remind command โ set one-time reminders with natural duration parsing (m/h/d/w/mo/y)
- New /reminders command โ view all active reminders with remaining time
- Background polling every 30 seconds to fire due reminders via DM
- New Reminder database table with automatic cleanup of expired entries
๐ก Command Improvements
- /hourly now shows nextAvailableAt field and special event drops
- /rank shows wallet, bank, net worth, and level breakdown
- /shop accepts a page option for browsing large inventories
- /sell shows remaining inventory quantity in the response
- /fish displays player Level field
- /interest shows nextAvailableAt field
- Deposit and withdraw commands now use unified coin emojis
๐ Consistency & Polish
- All embed emojis unified across every command (no more mixed icon sets)
- Hardcoded website URLs replaced with proper config-driven references
- Event info (name, multiplier, drops) now displayed on all eligible commands consistently
- Prefix command docs output now matches slash command docs output
- Wiki references updated to point to /docs instead of external wiki
๐ง Bug Fixes
- Fixed emoji parsing in text-based commands
- Fixed inconsistent embed colors across similar command groups
- Fixed interest command not showing accurate next available time
- Fixed quest expiry bug โ new quests now expire at next midnight instead of current midnight
โก Performance & Delay Reduction
- In-memory cooldown cache avoids DB round-trip for every command (checks cache first, falls back to DB)
- getActiveGlobalEvent() now cached with 30-second TTL โ called by nearly every earning command
- getPremiumStatus() now cached with 60-second TTL per user
- Added missing DB indexes: transactions (user_id, type), clan_members (user_id), feedback (guild_id), clan_log (clan_name), market_listings (seller_user_id)
- Dead code cleaned up: fishCatches constant, makePaginationRow imports, baseEmbedWithAuthor function
๐ Security
- SQL injection vulnerability fixed in getUserRank and top leaderboard queries (CASE WHEN parameterized binding)
- Timing-safe HMAC comparison for top.gg webhook signature verification
- API endpoint /api/economy/:guildId now requires x-api-key header
- Config crashes on missing BOT_OWNER_ID instead of silently defaulting to a hardcoded ID
- All owner ID references moved from hardcoded values to environment variable
โก Race Condition Fixes
- Cooldowns for work, beg, crime, fish now set after payouts (previously set before, risking locked cooldown on crash)
- Rob and heist cooldowns moved inside database transactions (roll back on failure)
- Clan deposit wrapped in proper BEGIN/COMMIT/ROLLBACK transaction
- Duel refund asymmetry fixed โ both challenger AND opponent refunded on game failure
- Blackjack wager deducted after game state initialization (not before)
๐ป Changelog Webhook
- No longer sends all 7 changelog entries on every restart
- Tracks last sent version in new app_meta DB table, only sends entries newer than it
- First deploy sends full history once, subsequent deploys only send new entries
๐งน Code Cleanup
- Removed empty barrel files (prefix/index.ts, slash/index.ts)
- Removed dead code: orphan exports in economy/constants, unused replyError helper
- Embed builder footer/timestamp extraction โ 5 functions now share a stamp() helper
- Removed 'cf' alias from coinflip prefix command (conflicted with default bot prefix)
- Express raw body parser restricted to application/json for webhook endpoint
๐ง Bug Fixes
- Empty catch blocks in API now log errors instead of silently swallowing
- getUserRank and top now use parameterized queries instead of string interpolation
๐งน Memory Leak Fixes
- Added 5-minute TTL auto-cleanup for pagination store entries (pagination entries no longer grow unbounded)
- Periodic eviction for settingsCache, messageCooldowns, commandRateLimits, prefixCache, and voteCooldowns
- Removed 2-minute full clear of dedup sets โ now uses timestamp-based eviction with 30-minute TTL
- Dedup sets changed from Set to Map<string, number> for precise expiry-based cleanup
๐ก๏ธ Crash Resilience
- All button interactions now wrapped in try/catch with proper error logging
- Autocomplete handler wrapped in try/catch to prevent unhandled rejections
- HTTP server now handles EADDRINUSE with automatic 5-second retry
- Shutdown handler has 15-second forced exit timeout to prevent hanging
- Webhook sender handles rate limits (429) with automatic retry and 5-second cooldown
๐ฌ Duplicate Message Prevention
- Button router no longer intercepts vote/server-list/collector buttons (they were incorrectly routed to blackjack handler)
- checkAndIncrementQuest wrapped in try/catch to prevent post-reply errors from causing double message.reply
- 30-minute dedup TTL ensures Discord reconnect replays are properly filtered
๐ Quest & Achievement Parity
- Prefix commands (work, beg, crime, fish, gamble, coinflip, slots, dice, bet) now track quests matching slash variants
- Achievements added to prefix: worker, beggar, criminal, fisher, gambler, high_roller, banker, shopaholic, rich_uncle
- Prefix weekly now uses actualAmount (includes event multiplier) and displays event info
- Prefix hourly now shows nextAvailableAt field and event info
- Prefix duel checks opponent balance before accepting
- Prefix buy itemKey now normalized with toLowerCase()
๐ป Top.gg Vote & Webhooks
- Top.gg webhook now correctly distributes vote rewards (500 coins + vote token) โ was previously dead code
- Changelog webhooks only fire on startup โ no longer re-sent every 6 hours in the status interval
- Webhook functions consolidated with rate-limit handling and automatic retry on 429
- Status webhook now includes complete server stats with proper error fallbacks
๐ง Command & Data Fixes
- /exportdata crash fixed โ removed dropped guild_id column from query
- createClan wrapped in transaction (was creating orphaned rows on partial failure)
- transfer now creates two-sided transaction history (recipients see incoming transfers)
- admin resetwealth parameter renamed from max_wealth to min_wealth to match actual >= SQL behavior
- Global event duration validation โ invalid durations now show clear error instead of creating permanent event
- statusApi endpoint won't hang โ all async calls now wrapped in try/catch
- getPremium called once in buyItem instead of twice (one DB round-trip saved)
- first_coin achievement logic simplified โ no NaN risk from string/number coercion
- useItem default case refund wrapped in try/catch (item no longer permanently lost if addItem fails)
- economyApi endpoint provides accurate data shape matching guildId parameter
๐ Achievements Display
/profile now shows achievement progress
/leaderboard has an achievement category to rank by unlocks
๐ฐ Premium Server Grants
- Server-wide premium can be granted through giveaways, promotions, testing, or community rewards
- Premium servers let members use premium perks while they interact with CoinForge in that server
- Owner command:
/admin serverpremium
๐ Global Events
- Events are now global across all servers with custom names, durations, drop items, and rates
- Boosted XP, coins, and fishing rates
๐ง Bug Fixes
- Quest tracking fixed (mine, fish, hunt, chop, craft)
- Shop parser handles multi-word items. Event badge/expiry logic corrected
- Blackjack push tie result, warning system, fun commands, vouch system, prefix reset, fish rarity colors all fixed
โญ More Premium Perks
- 2x weekly rewards, 1.5x XP multiplier, daily streak freeze
- 3 exclusive premium-only shop items: Golden Watch, Diamond Ring, Premium Crate
๐ Achievements
- 16 achievements to unlock across all activities
- Use
/achievements to view progress
โฑ๏ธ Gambling Cooldowns
- Added cooldowns to all gambling commands to fix exploit spam
- Premium users enjoy half the cooldown duration
๐๏ธ Premium Shop Discount
- Premium users get 10% off all shop purchases
๐ Admin Commands
/admin premium accepts duration in days
/admin findwealth and /admin resetwealth for economy management
๐ Codebase Audit
- Fixed critical premium NULL bug, cooldown key mismatches, removed duplicate functions
๐ top.gg Voting
- New
/vote command with rewards, vote badges, and auto-refreshing status page
โญ Premium System
- Bot owner can grant premium via
/admin premium add/remove
- 2x daily rewards, 2x chat coins, +1% bonus interest
๐ฌ Chat Rewards
- Earn 2 coins per message with spam protection, builds chat bonus for interest
๐ฒ New Commands
/bet โ single-player bet with better odds
/duel โ challenge another player with interactive buttons
๐ต Interest Boost
- Interest now pays accumulated chat bonus alongside standard 2%
๐ Global Economy
- Users, balances, XP, items, and cooldowns are now global across all servers
๐งน Cross-Server Clans
- Clans are now global with invites, roles, descriptions, and activity logs
๐ Clan XP & Levels
- 25% of XP goes to clan. Level up for more members and interest bonus
๐ Security Patches
- Wager front-running fixed โ bets deduct before game resolves
- Interest race condition fixed โ atomic SQL transaction with cooldown lock
๐ฒ Payout Rework
- Blackjack and slots payouts recalculated for new upfront-deduction model
๐น Interest Command
- Earn 2% daily interest on bank balance. Claim every 22 hours, capped at 5,000/day
๐ Website v2.0
- Complete visual redesign with glassmorphism, new typography, animated backgrounds
๐๏ธ Architecture Refactor
- Blackjack engine extracted to module, codebase more maintainable
๐ฃ Interactive Commands
- /commands page with live search and category filter
๐๏ธ Shop & Market
/buy [quantity] for multi-purchase
- Market pagination for browsing
๐ฆ Mystery Boxes
- New prizes including Lucky Ace, Fishing Rod, and another Mystery Box
โ๏ธ Fixes
- Use cooldown, race condition fix, changelog in nav bar
๐ Blackjack
- Interactive Hit/Stand buttons. Blackjack pays 1.5x
๐ฐ Lottery
- Buy tickets, auto-draw every 6 hours, 90% pot to winner
๐
Daily Streaks
- Consecutive claims give +25% per day up to 3x
โน๏ธ Utilities
/iteminfo, /cooldowns, /support commands
๐ฐ Lottery System
- Buy tickets for a chance to win the server pot
๐
Daily Streaks
- Bonus multipliers for consecutive claims
๐ฏ New Commands
- Heist, Interest, Gift Item, Rank commands
๐๏ธ Shop Expansion
- Heist Blueprint (3,500) and Lucky Ace (2,500)
๐ Website Overhaul
- Live stats, dark theme, mobile-friendly, terms/privacy pages