Discord Premium Access Bot

Test this app for free
23
from shared import format_pass_type

from shared import calculate_end_date

import os
import discord
from discord import app_commands
from discord.ui import Button, View, Select
from abilities import apply_sqlite_migrations
from datetime import datetime, timedelta
from models import Base, engine, Purchase, Transaction, ServerSettings
from sqlalchemy.orm import Session
from sqlalchemy import func, and_

def generate_oauth_link(client_id):
    base_url = "https://discord.com/api/oauth2/authorize"
    redirect_uri = "http://localhost"
    scope = "bot"
    permissions = "8"
    return f"{base_url}?client_id={client_id}&permissions={permissions}&scope={scope}"

from paypal_utils import PayPalAPI

class PaymentMethodView(View):
Get full code

Frequently Asked Questions

Hobby or interest-based communities offering expert workshops or exclusive events. The bot's flexible pass types (1 day, 1 week, 1 month, and subscription) allow for versatile monetization strategies tailored to your community's needs. ### Q3: How does the financial tracking feature help in managing the business aspect of my Discord server?

The Discord Premium Access Bot includes robust financial tracking features that are crucial for managing the business side of your server. The /profit and /profit-detailed commands provide comprehensive analytics on your premium pass sales. These include:

Month-over-month comparisons to track growth. This data allows you to make informed decisions about pricing, promotions, and which pass types or payment methods to focus on. It also simplifies financial reporting and tax preparation for your Discord-based business. ### Q4: How can I customize the premium role assignment for my server using this bot?

The Discord Premium Access Bot allows for easy customization of premium role assignment using the /setrole command. Here's an example of how to use it:

```python @tree.command(name="setrole") async def setrole(interaction: discord.Interaction, role: discord.Role): """Set the premium role for this server (Admin only)""" if not interaction.user.guild_permissions.administrator: await interaction.response.send_message("❌ You need administrator permissions to use this command!", ephemeral=True) return

# Check if the bot's role is lower than the premium role
if interaction.guild.me.top_role <= role:
    await interaction.response.send_message("❌ The premium role must be lower than my highest role!", ephemeral=True)
    return

with Session(engine) as session:
    settings = session.query(ServerSettings).filter_by(server_id=str(interaction.guild.id)).first()
    if settings:
        settings.premium_role_id = str(role.id)
    else:
        settings = ServerSettings(server_id=str(interaction.guild.id), premium_role_id=str(role.id))
        session.add(settings)
    session.commit()

await interaction.response.send_message(f"✅ Premium role has been set to {role.mention}", ephemeral=True)

```

This command allows server administrators to set any existing role as the premium role. The bot will automatically assign this role to users when they purchase a premium pass.

Q5: How does the bot handle different payment verification processes for various payment methods?

A: The Discord Premium Access Bot implements separate verification processes for different payment methods to ensure secure and accurate premium access activation. Here's an example of how it handles CashApp verification:

```python @tree.command(name="verify-cashapp") async def verify_cashapp(interaction: discord.Interaction, payment_id: str): """Submit your CashApp payment ID to verify your payment""" with Session(engine) as session: transaction = session.query(Transaction).join(Purchase).filter( and_( Purchase.user_id == str(interaction.user.id), Transaction.payment_method == 'cashapp', Purchase.is_active == False ) ).order_by(Transaction.transaction_date.desc()).first()

    if not transaction:
        await interaction.response.send_message(
            "❌ No pending CashApp payment found. Please start a new purchase using `/purchase`",
            ephemeral=True
        )
        return

    transaction.cashapp_payment_id = payment_id
    transaction.purchase.is_active = True
    session.commit()

    # Add premium role if configured
    settings = session.query(ServerSettings).filter_by(server_id=str(interaction.guild.id)).first()
    if settings and settings.premium_role_id:
        try:
            role = interaction.guild.get_role(int(settings.premium_role_id))
            if role:
                await interaction.user.add_roles(role)
        except Exception as e:
            print(f"Error adding premium role: {str(e)}")

    await interaction.response.send_message("✅ Your CashApp payment has been verified and your premium access is now active!", ephemeral=True)

```

This command allows users to submit their CashApp payment ID, which the bot then uses to verify and activate their premium access. Similar verification processes are implemented for other payment methods, ensuring a secure and user-friendly experience across all supported payment options.

Created: | Last Updated:

DIscord Bot made by discord.gg/cowrine

Here's a step-by-step guide for using the Discord Premium Access Bot template:

Introduction

This template provides a Discord bot for managing premium memberships with multiple payment options, automatic role assignment, financial tracking, and user management features. The bot allows server administrators to set up premium passes, handle various payment methods, and track revenue.

Getting Started

To begin using this template:

  1. Click the "Start with this Template" button in the Lazy Builder interface.

Initial Setup

Before running the bot, you need to set up some environment secrets:

  1. Go to the Discord Developer Portal and create a new application:
  2. Create a bot for your application
  3. Copy the Bot Token
  4. Copy the Client ID

  5. Set up the following environment secrets in the Lazy Builder's Environment Secrets tab:

  6. BOT_TOKEN: Paste your Discord Bot Token
  7. CLIENT_ID: Paste your Discord Application Client ID
  8. CASHAPP_HANDLE: Your CashApp handle (e.g., $YourCashAppName)
  9. VENMO_HANDLE: Your Venmo handle (e.g., @YourVenmoName)
  10. BITCOIN_WALLET: Your Bitcoin wallet address
  11. ETH_WALLET: Your Ethereum wallet address
  12. LTC_WALLET: Your Litecoin wallet address
  13. PAYPAL_CLIENT_ID: Your PayPal API Client ID
  14. PAYPAL_CLIENT_SECRET: Your PayPal API Client Secret

To get the PayPal API credentials: 1. Go to the PayPal Developer Dashboard (developer.paypal.com) 2. Log in or create an account 3. Navigate to "My Apps & Credentials" 4. Under "REST API apps," click "Create App" 5. Give your app a name and click "Create App" 6. In the resulting page, you'll find your Client ID and Secret

Test

After setting up the environment secrets:

  1. Click the "Test" button in the Lazy Builder interface.
  2. The bot will start, and you'll see a message with an OAuth link to invite the bot to your Discord server.

Using the Bot

Once the bot is invited to your server:

  1. Use the /setrole command to set the premium role for your server (admin only).
  2. Members can use /purchase to start the premium pass purchase process.
  3. After payment, members use the appropriate verification command (e.g., /verify-cashapp, /verify-btc) to activate their premium access.
  4. Members can check their status with /status or /time-left.
  5. Admins can view profit reports using /profit and /profit-detailed.

Integrating the Bot

To fully integrate the bot into your Discord server:

  1. Set up a premium channel or category in your Discord server.
  2. Use Discord's built-in permissions to restrict access to these channels to users with the premium role you set using /setrole.
  3. Create a channel for purchase instructions and pin a message with the /purchase command information.
  4. Consider setting up webhooks in a private channel to monitor transactions and member activity.

By following these steps, you'll have a fully functional Premium Access Bot for your Discord server, allowing you to manage premium memberships and process payments through various methods.



Template Benefits

  1. Monetization of Discord Communities: This bot enables server owners to create a tiered membership system, allowing them to monetize their Discord communities by offering premium access to exclusive content or features.

  2. Flexible Payment Options: By supporting multiple payment methods (PayPal, CashApp, Venmo, and cryptocurrencies), the bot caters to a wider audience and increases the likelihood of successful transactions, potentially boosting revenue.

  3. Automated Membership Management: The bot handles the entire process of purchasing, verifying payments, and granting access automatically, reducing administrative overhead and ensuring a smooth user experience.

  4. Financial Tracking and Analytics: With built-in profit tracking and detailed analytics, server owners can gain valuable insights into their revenue streams, helping them make data-driven decisions to optimize their pricing and offerings.

  5. Customizable Role Integration: The ability to automatically assign and remove roles based on premium status allows for seamless integration with existing server structures, enhancing the value proposition of premium memberships.

Technologies

Airtable with Lazy AI – Enhance Data Management for Project, OKR, Finance, Workflows and More Airtable with Lazy AI – Enhance Data Management for Project, OKR, Finance, Workflows and More
Boost Your Canva Designs with Lazy AI: Automate Templates, Streamline Creativity and More Boost Your Canva Designs with Lazy AI: Automate Templates, Streamline Creativity and More
Optimize AWS Workflows with Lazy AI: Automate Deployments, Scaling, Monitoring and More Optimize AWS Workflows with Lazy AI: Automate Deployments, Scaling, Monitoring and More
Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask
Lazy AI for Laravel: Admin, Dashboard, eCommerce, CRM, SaaS and More Lazy AI for Laravel: Admin, Dashboard, eCommerce, CRM, SaaS and More
Enhance Ruby Development with Lazy AI: Automate Web Apps, APIs and More Enhance Ruby Development with Lazy AI: Automate Web Apps, APIs and More
Streamline Webflow Projects with Lazy AI: Automate Design, Content, API Integrations and More  Streamline Webflow Projects with Lazy AI: Automate Design, Content, API Integrations and More
Optimize Claude AI Workflows with Lazy AI: Automate Prompting, Integrations, Deployment and More  Optimize Claude AI Workflows with Lazy AI: Automate Prompting, Integrations, Deployment and More
Streamline Telegram Automation with Lazy AI: Automate Bots, Messages, Workflows and More Streamline Telegram Automation with Lazy AI: Automate Bots, Messages, Workflows and More
Python App Templates for Scraping, Machine Learning, Data Science and More Python App Templates for Scraping, Machine Learning, Data Science and More
Discord Automation & Bots Discord Automation & Bots
Streamline TikTok Workflows with Lazy AI: Automate Content Creation, Scheduling, Analytics and More  Streamline TikTok Workflows with Lazy AI: Automate Content Creation, Scheduling, Analytics and More

Similar templates

We found some blogs you might like...