-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8119a0f
commit e4bcfec
Showing
6 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,47 @@ | ||
import nextcord | ||
import pymysql | ||
from nextcord.ext import commands | ||
from nextcord import Interaction, SlashOption | ||
from utils import check_premium, create_error_embed, PREMIUMLINK | ||
from utils import check_premium, create_error_embed, create_warning_embed, PREMIUMLINK, DBENDPOINT, DBUSER, DBPASS, DBNAME | ||
|
||
class Premium(commands.Cog): | ||
def __init__(self, client: commands.Bot): | ||
self.client = client | ||
|
||
@nextcord.slash_commands(name=f"manage-premium", description=f"Manage your premium membership") | ||
@nextcord.slash_command(name=f"manage-premium", description=f"Manage your premium membership", guild_ids=[1111387758028652657, 801744339343507457]) | ||
async def manage_premium(self, interaction: Interaction): | ||
pass | ||
|
||
@manage_premium(name=f"add-server", description=f"Add a server to your premium subscription") | ||
@manage_premium.subcommand(name=f"add-server", description=f"Add a server to your premium subscription") | ||
async def manage_premium_add_server(self, interaction: Interaction, | ||
guildid: str = SlashOption( | ||
name=f"guild", | ||
description=f"The ID of the guild you want to add to your premium subscription. Use /debug in your server to get the server ID", | ||
description=f"The ID of the guild to add to premium. Use /debug in your server to get this.", | ||
required = True | ||
)): | ||
await interaction.response.defer() | ||
if not check_premium(interaction.user.id): | ||
if not check_premium(False, True, interaction.user.id): | ||
await interaction.send(embed=create_error_embed(title=f"No premium subscription", description=f"You are not currently subscribed to any of our premium subscriptions. To purchase premium please follow [this link]({PREMIUMLINK})\n\n\nPlease Note: If you recently subscribed to premium it may take up to 30 minutes to register your subscription. If you are still unable to use this command in 30 minutes, please create a ticket in ")) | ||
return | ||
|
||
if check_premium(True, False, guildid): | ||
await interaction.send(embed=create_warning_embed(title=f"Guild already added", description=f"This guild is already added to your premium subscription.")) | ||
return | ||
|
||
conn = pymysql.connect(host=DBENDPOINT, port=3306, user=DBUSER, password=DBPASS, db=DBNAME) | ||
cur = conn.cursor() | ||
cur.execute("SELECT * FROM sv_premium_users WHERE user_id = %s", (interaction.user.id)) | ||
data = cur.fetchall() | ||
|
||
servers_available = int(data[0][1]) | ||
|
||
cur.execute("SELECT * FROM sv_premium_guilds WHERE user_id = %s", (interaction.user.id)) | ||
data = cur.fetchall() | ||
|
||
servers_used = len(data) if data else 0 | ||
|
||
|
||
|
||
|
||
def setup(client: commands.Bot): | ||
client.add_cog(Premium(client)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
e = "dhasgdy" | ||
print(e.split(",")) |
This file contains 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
This file contains 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
This file contains 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