Skip to content

refactor: Discord premium system with Stripe integration and async fixes#13

Open
bergaman9 wants to merge 2 commits intomainfrom
claude/refactor-discord-premium-EldAy
Open

refactor: Discord premium system with Stripe integration and async fixes#13
bergaman9 wants to merge 2 commits intomainfrom
claude/refactor-discord-premium-EldAy

Conversation

@bergaman9
Copy link
Owner

  • Upgrade discord.py requirement to >=2.4.0, add stripe>=7.0.0
  • Fix PremiumModel: convert all sync pymongo calls to async Motor (await),
    switch to guild-based premium model, use timezone-aware datetimes
  • Add PaymentMethod.STRIPE enum value to support card payments
  • Create StripeService (src/services/stripe_service.py) with checkout
    sessions, payment intents, and webhook verification
  • Refactor premium_required decorator to support both prefix commands
    (ctx) and slash/hybrid commands (discord.Interaction); fix PremiumTier
    string-vs-enum comparison bug; add app_premium_required for slash-only use
  • Rewrite Premium cog: inherit BaseCog, use commands.hybrid_group with
    hybrid subcommands (info, status, payment, activate, grant, revoke),
    add Stripe checkout alongside existing crypto flow, fix admin permission
    checks via commands.has_permissions (works for both prefix + slash)
  • Add cog_app_command_error to BaseCog for slash command error handling

https://claude.ai/code/session_01HM9b3MRUsKcSpY3e1TApEf

claude added 2 commits March 12, 2026 11:43
- Upgrade discord.py requirement to >=2.4.0, add stripe>=7.0.0
- Fix PremiumModel: convert all sync pymongo calls to async Motor (await),
  switch to guild-based premium model, use timezone-aware datetimes
- Add PaymentMethod.STRIPE enum value to support card payments
- Create StripeService (src/services/stripe_service.py) with checkout
  sessions, payment intents, and webhook verification
- Refactor premium_required decorator to support both prefix commands
  (ctx) and slash/hybrid commands (discord.Interaction); fix PremiumTier
  string-vs-enum comparison bug; add app_premium_required for slash-only use
- Rewrite Premium cog: inherit BaseCog, use commands.hybrid_group with
  hybrid subcommands (info, status, payment, activate, grant, revoke),
  add Stripe checkout alongside existing crypto flow, fix admin permission
  checks via commands.has_permissions (works for both prefix + slash)
- Add cog_app_command_error to BaseCog for slash command error handling

https://claude.ai/code/session_01HM9b3MRUsKcSpY3e1TApEf
## Critical Bug Fixes (cogs not loading at all)
- Fix cogs/utility/__init__.py: remove broken module-level imports
  (ai_chat, tickets, starboard, custom_commands_manager don't exist in utility/)
  and fix class names (InviteTracker, not Invites)
- Add cogs/ai/__init__.py: PerplexityChat + ServerDesigner were never loading
- Add cogs/support/__init__.py: Ticket cog was never loading
- Add cogs/custom_commands/__init__.py: CustomCommandsManager was never loading
- Fix cogs/community/__init__.py: add missing Starboard cog to setup

## Utils Modularization (code out of __init__.py)
- utils/formatting/__init__.py (238 lines) split into:
  - formatting/embeds.py  — create_embed()
  - formatting/text.py    — truncate_text, format_timestamp, sanitize_mentions,
                            create_progress_bar, hex_to_int, time helpers
  - formatting/__init__.py now a thin re-export (all existing imports unchanged)
- utils/class_utils/__init__.py (194 lines) split into:
  - class_utils/paginator.py — Paginator UI view class
  - class_utils/__init__.py  — thin re-export
- utils/discord/__init__.py (134 lines) split into:
  - discord/helpers.py      — check_if_ctx_or_interaction,
                               respond_to_ctx_or_interaction, create_basic_embed
  - discord/__init__.py     — thin re-export

## Services Cleanup
- Create services/payment/ package:
  - payment/crypto.py  — CryptoVerificationService (canonical location)
  - payment/stripe.py  — StripeService (canonical location)
  - payment/__init__.py — package re-export
- services/crypto_verification.py → backward-compat re-export shim
- services/stripe_service.py      → backward-compat re-export shim
- services/__init__.py exposes CryptoVerificationService + StripeService
- Remove services/guild.py and services/user.py (exact duplicates of
  guild_service.py and user_service.py; __init__.py already used _service versions)

https://claude.ai/code/session_01HM9b3MRUsKcSpY3e1TApEf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants