Final Store Commit
This commit is contained in:
parent
e455af564d
commit
f41798184c
3
bot.py
3
bot.py
@ -1,4 +1,4 @@
|
|||||||
from commands import help, ticket
|
from commands import help, ticket, store
|
||||||
|
|
||||||
# pip install imports
|
# pip install imports
|
||||||
import discord, aiofiles
|
import discord, aiofiles
|
||||||
@ -55,6 +55,7 @@ class MyBot(commands.Bot):
|
|||||||
self.add_view(ticket.CreateButton())
|
self.add_view(ticket.CreateButton())
|
||||||
self.add_view(ticket.CloseButton())
|
self.add_view(ticket.CloseButton())
|
||||||
self.add_view(ticket.TrashButton())
|
self.add_view(ticket.TrashButton())
|
||||||
|
self.add_view(store.SelectView())
|
||||||
print(f'\33[32mLogged in as {self.user} (ID: {self.user.id})')
|
print(f'\33[32mLogged in as {self.user} (ID: {self.user.id})')
|
||||||
print('------')
|
print('------')
|
||||||
|
|
||||||
|
@ -84,18 +84,7 @@ class Select(discord.ui.Select):
|
|||||||
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "silver"}})
|
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "silver"}})
|
||||||
await interaction.followup.send("You bought the silver ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
await interaction.followup.send("You bought the silver ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
elif self.values[0] == "Gold Ticket":
|
||||||
class SelectView(discord.ui.View):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(timeout=None)
|
|
||||||
self.add_item(Select())
|
|
||||||
|
|
||||||
class GoldButton(View):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(timeout=None)
|
|
||||||
|
|
||||||
@button(label="Buy Gold", style=discord.ButtonStyle.blurple, custom_id="gold")
|
|
||||||
async def gold(self, interaction: discord.Interaction, button: Button):
|
|
||||||
await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer(ephemeral=True)
|
||||||
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
||||||
db = client.servers
|
db = client.servers
|
||||||
@ -120,13 +109,7 @@ class GoldButton(View):
|
|||||||
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "gold"}})
|
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "gold"}})
|
||||||
await interaction.followup.send("You bought the gold ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
await interaction.followup.send("You bought the gold ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
elif self.values[0] == "Diamond Ticket":
|
||||||
class DiamondButton(View):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(timeout=None)
|
|
||||||
|
|
||||||
@button(label="Buy Diamond", style=discord.ButtonStyle.blurple, custom_id="diamond")
|
|
||||||
async def diamond(self, interaction: discord.Interaction, button: Button):
|
|
||||||
await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer(ephemeral=True)
|
||||||
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
||||||
db = client.servers
|
db = client.servers
|
||||||
@ -151,13 +134,7 @@ class DiamondButton(View):
|
|||||||
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "diamond"}})
|
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": "diamond"}})
|
||||||
await interaction.followup.send("You bought the diamond ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
await interaction.followup.send("You bought the diamond ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
elif self.values[0] == "Emerald Ticket":
|
||||||
class EmeraldButton(View):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(timeout=None)
|
|
||||||
|
|
||||||
@button(label="Buy Emerald", style=discord.ButtonStyle.blurple, custom_id="emerald")
|
|
||||||
async def bronze(self, interaction: discord.Interaction, button: Button):
|
|
||||||
await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer(ephemeral=True)
|
||||||
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
client = pymongo.MongoClient(os.getenv("mongo_url"))
|
||||||
db = client.servers
|
db = client.servers
|
||||||
@ -183,6 +160,11 @@ class EmeraldButton(View):
|
|||||||
await interaction.followup.send("You bought the emerald ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
await interaction.followup.send("You bought the emerald ticket! Redeem it in the Blob support server for rewards!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
class SelectView(discord.ui.View):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(timeout=None)
|
||||||
|
self.add_item(Select())
|
||||||
|
|
||||||
class store(commands.Cog):
|
class store(commands.Cog):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
@ -192,9 +174,8 @@ class store(commands.Cog):
|
|||||||
print('Tickets Online')
|
print('Tickets Online')
|
||||||
|
|
||||||
@commands.hybrid_command(name="store", description="View the store")
|
@commands.hybrid_command(name="store", description="View the store")
|
||||||
@commands.has_permissions(administrator=True)
|
|
||||||
@commands.check(is_enabled)
|
@commands.check(is_enabled)
|
||||||
async def ticket(self, ctx):
|
async def store(self, ctx):
|
||||||
em = discord.Embed(title="Shop!", description="Spend some Bloboons to get cool rewards! Redeem in supported servers!", color=ctx.author.color)
|
em = discord.Embed(title="Shop!", description="Spend some Bloboons to get cool rewards! Redeem in supported servers!", color=ctx.author.color)
|
||||||
em.add_field(name="Bronze Ticket", value="100 Bloboons", inline=False)
|
em.add_field(name="Bronze Ticket", value="100 Bloboons", inline=False)
|
||||||
em.add_field(name="Silver Ticket", value="200 Bloboons", inline=False)
|
em.add_field(name="Silver Ticket", value="200 Bloboons", inline=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user