refactor: Discord premium system with Stripe integration and async fixes#13
Open
refactor: Discord premium system with Stripe integration and async fixes#13
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
switch to guild-based premium model, use timezone-aware datetimes
sessions, payment intents, and webhook verification
(ctx) and slash/hybrid commands (discord.Interaction); fix PremiumTier
string-vs-enum comparison bug; add app_premium_required for slash-only use
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)
https://claude.ai/code/session_01HM9b3MRUsKcSpY3e1TApEf