Skip to content

Commit f451f2f

Browse files
authored
Merge pull request #37 from PyBotDevs/archisha69-open
Added `/open` command
2 parents 109d6fa + 85922d3 commit f451f2f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

main.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,65 @@ async def dig(ctx:SlashContext):
631631
save()
632632
await ctx.reply('YOU FELL INTO YOUR OWN TRAP AND DIED LMFAO\nYou lost 2000 coins in the process.')
633633

634+
#need help cuz i only got the idea (aka the logic) and not the code detail and stuff
635+
@slash.slash(
636+
name='open',
637+
description='Opens lootbox(es) in your inventory',
638+
options=[
639+
create_option(name='lootbox', description='What lootbox do you want to open?', option_type=3, required=True),
640+
create_option(name='amount', description='How many do you want to open?', option_type=4, required=True)
641+
]
642+
)
643+
async def open(ctx:SlashContext, lootbox:str, amount:int):
644+
types = ["normal", "large", "special"]
645+
if amount <= 0: return await ctx.reply("You can't open 0 or below lootboxes! Don't be stupid.", hidden=True)
646+
if lootbox not in types: return await ctx.reply(f"wtf is {lootbox}?", hidden=True)
647+
ie = shopitem.keys()
648+
normal_loot = [
649+
random.randint(10000, 25000),
650+
random.choice(list(ie)),
651+
random.choice(list(ie))
652+
]
653+
large_loot = [
654+
random.randint(50000, 75000),
655+
random.choice(list(ie)),
656+
random.choice(list(ie)),
657+
random.choice(list(ie))
658+
]
659+
special_loot = [
660+
random.randint(100000, 500000),
661+
random.choice(list(ie)),
662+
random.choice(list(ie)),
663+
random.choice(list(ie)),
664+
random.choice(list(ie)),
665+
random.choice(list(ie))
666+
]
667+
localembed = discord.Embed(title="You opened a lootbox!", description=f"The amazing rewards of your {lootbox} lootbox behold you...", color=discord.Color.gold())
668+
if lootbox == "normal":
669+
currency["wallet"][str(ctx.author.id)] += normal_loot[0]
670+
items[str(ctx.author.id)][normal_loot[1]] += 1
671+
items[str(ctx.author.id)][normal_loot[2]] += 1
672+
localembed.add_field(name="Coins gained", value=f"**{normal_loot[0]}** coins", inline=False)
673+
localembed.add_field(name="Items recieved", value=f"You got **1 {normal_loot[1]}**!\nYou got **1 {normal_loot[2]}**!", inline=False)
674+
if lootbox == "large":
675+
currency["wallet"][str(ctx.author.id)] += large_loot[0]
676+
items[str(ctx.author.id)][large_loot[1]] += 1
677+
items[str(ctx.author.id)][large_loot[2]] += 1
678+
items[str(ctx.author.id)][large_loot[3]] += 1
679+
localembed.add_field(name="Coins gained", value=f"**{large_loot[0]}** coins", inline=False)
680+
localembed.add_field(name="Items recieved", value=f"You got **1 {large_loot[1]}**!\nYou got **1 {large_loot[2]}**!\nYou got **1 {large_loot[3]}**!", inline=False)
681+
if lootbox == "special":
682+
currency["wallet"][str(ctx.author.id)] += special_loot[0]
683+
items[str(ctx.author.id)][special_loot[1]] += 1
684+
items[str(ctx.author.id)][special_loot[2]] += 1
685+
items[str(ctx.author.id)][special_loot[3]] += 1
686+
items[str(ctx.author.id)][special_loot[4]] += 1
687+
items[str(ctx.author.id)][special_loot[5]] += 1
688+
localembed.add_field(name="Coins gained", value=f"**{special_loot[0]}** coins", inline=False)
689+
localembed.add_field(name="Items recieved", value=f"You got **1 {special_loot[1]}**!\nYou got **1 {special_loot[2]}**!\nYou got **1 {special_loot[3]}**!\nYou got **1 {special_loot[4]}**!\nYou got **1 {special_loot[5]}**!", inline=False)
690+
await ctx.send(embed=localembed)
691+
save()
692+
634693
@slash.slash(
635694
name='echo',
636695
description='Sends a bot message in the channel',

0 commit comments

Comments
 (0)