"""π•„π•’π•šπ•Ÿ.𝕑π•ͺ""" import discord from discord.ext import commands import json import os import random import exception import instance import aiohttp import time from keep_alive import keep_alive client=commands.Bot(command_prefix=";") @client.event async def on_ready(): print("im ready") await client.change_presence(activity=discord.Game(name="Economy")) @client.event async def on_command_error(ctx, error): if isinstance(error, commands.CommandOnCooldown): em=discord.Embed(title='This command is on a %.2fs cooldown' % error.retry_after) await ctx.send(embed=em) raise error @client.command() async def cmd(ctx): em=discord.Embed(title="moNey baStard",description="my prefix is '-'",color=0xfc0303) em.add_field(name="**currency**",value="**πŸ’Έ withdraw {amount}**\n> withdraws money from bank\n**πŸ’° deposite {amount}**\n> deposites money from bank\n**πŸ’³ balance**\n> shows your money\n**:palms_up_together: beg**\n> gives you money \n**πŸ›’ buy {item name}**\n> you can buy items from the shop\n**:dollar: sell {item name}**\n> you can sell items\n**:fishing_pole_and_fish: fish**\n> gives you fishes which you can sell for earning money\n**πŸ—‘οΈ hunt**\n> gives you animals or birds which you can sell later for earning money\n**πŸŽ’ bag**\n> shows your inventory\n**πŸ›οΈ shop**\n> shows the items with prices\n**:pick: mine**\n> gives you ores which you can sell later for earning money\n**:axe: chop**\n> gives you woods which you can sell later for earning money\n**Ⓜ️ pm**\n> you can post memes and gain some moneys from ad revenue\n**πŸ—“οΈ daily**\n> gives you money every time you use the command") await ctx.send(embed=em) mainshop=[ {"name": "watch", "price": 2500,"description":"time"}, {"name": "laptop", "price": 50000,"description":"me"}, {"name": "pc", "price": 100000,"description":"se"}, {"name": "fishingpole", "price": 10000,"description":"you can catch fish and sell them"}, {"name": "woodensword", "price": 10000,"description":"can hunt down some animals and sell them"}, {"name": "axe", "price": 20000,"description":"you can chop down woods with an axe"}, {"name": "pickaxe", "price": 35000,"description":"Pickaxe can mine ores using it"}, {"name": "phone", "price": 50000,"description":"call"} ] sellable_items=[ {"name": "boar", "price": 1000}, {"name": "snake", "price": 5000}, {"name": "deer", "price": 800}, {"name": "rabbit", "price": 200}, {"name": "duck", "price": 50}, {"name": "common-fish", "price": 100}, {"name": "uncommon-fish", "price": 300}, {"name": "rare-fish", "price": 500}, {"name": "epic-fish", "price": 1000}, {"name": "stone","price": 100}, {"name": "oak-wood", "price":100}, {"name": "coal", "price":200}, {"name": "birch-wood", "price":200}, {"name": "copper", "price":300}, {"name": "jungle-wood", "price":300}, {"name": "iron-ore", "price": 500}, {"name": "dark-wood", "price":500}, {"name": "quartz", "price":1000}, {"name": "maple-wood", "price":1000} ] #================balance================================ @client.command(aliases=["bal"]) async def balance(ctx, member:discord.Member = None): if member == None: member = ctx.author await open_account(member) user = member users = await get_bank_data() wallet_amt = users[str(user.id)]["wallet"] bank_amt = users[str(user.id)]["bank"] embed = discord.Embed(title=f"{member.name}'s balance ", color=0xFFD700) embed.add_field(name="Wallet balance", value=wallet_amt) embed.add_field(name="bank balance", value=bank_amt) await ctx.reply(embed=embed) @client.command(pass_context=True) async def meme(ctx): embed = discord.Embed(title="meme", description=None) async with aiohttp.ClientSession() as cs: async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r: res = await r.json() embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url']) await ctx.send(embed=embed) #================helper function================================ async def open_account(user): users = await get_bank_data() if str(user.id) in users: return False else: users[str(user.id)] = {} users[str(user.id)]["wallet"] = 0 users[str(user.id)]["bank"] = 0 users[str(user.id)]["bag"]={} with open('mainbank.json', 'w') as f: json.dump(users, f) return True async def get_bank_data(): with open('mainbank.json', 'r') as f: users = json.load(f) return users #================withdraw================================ @client.command(aliases=["with"]) async def withdraw(ctx, amount=None): await open_account(ctx.author) if amount == None: await ctx.send("please enter the amount") return bal=await update_bank(ctx.author) amount = int(amount) if amount > bal[1]: await ctx.reply("you dont have enough money") return if amount == "all": amount = bal[0] if amount < 0: await ctx.reply("Can't withdraw negative money") return await update_bank(ctx.author, amount) await update_bank(ctx.author,-1*amount, "bank") await ctx.reply(f"you withdrawed {amount} money") #================deposite================================ @client.command(aliases=['dep']) async def deposite(ctx,amount=None,aliases=["dep"]): await open_account(ctx.author) if amount == None: await ctx.reply("please enter the amount") return bal=await update_bank(ctx.author) amount= int(amount) if amount>bal[0]: await ctx.reply("you dont have enough money") return if amount == "all": amount = bal[0] if amount < 0: await ctx.reply("Can't withdraw negative money") return await update_bank(ctx.author,-1*amount,"wallet") await update_bank(ctx.author,amount,"bank") await ctx.reply(f"you deposited {amount} money") #================give money cmd================================ @client.command() async def give(ctx,member:discord.Member,amount=None): await open_account(ctx.author) await open_account(member) if amount == None: await ctx.reply("please enter the amount") return bal=await update_bank(ctx.author) amount= int(amount) if amount>bal[1]: await ctx.reply("you dont have enough money") return if amount < 0: await ctx.reply("Can't withdraw negative money") return await update_bank(ctx.author,-1*amount,"bank") await update_bank(member,amount,"bank") await ctx.reply(f"you gave {amount} money") #================rob command================================ @client.command() async def rob(ctx,member:discord.Member,amount=None): await open_account(ctx.author) await open_account(member) bal=await update_bank(ctx.author) if int(amount)>bal[0]<100: await ctx.send("Not worth it man,the guys has less than 100") return if int(amount) < 0: await ctx.send("Can't withdraw negative money") return earnings=random.randrange(0,bal[0]) await update_bank(ctx.author,earnings) await update_bank(member,-1*earnings) await ctx.send(f"you robbed{member.mention} and got {earnings} money") #================beg command================================ @client.command() @commands.cooldown(1, 30, commands.BucketType.user) async def beg(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() this = random.randrange(101) await ctx.send(f"{ctx.author.mention} Someone gave you {this} coins and your shame level wen't up!") users[str(user.id)]["wallet"] += this with open('mainbank.json', 'w') as f: json.dump(users, f) #================helper function================================ async def update_bank(user,change = 0, mode = "wallet"): users = await get_bank_data() users[str(user.id)][mode]+= change with open("mainbank.json","w") as f: json.dump(users,f) bal = users[str(user.id)]["wallet"],users[str(user.id)]["bank"] return bal #================test================================ @client.command() async def reply(ctx): await ctx.reply("sup") #================fishing command================================ @client.command() @commands.cooldown(1, 45, commands.BucketType.user) async def fish(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() inv = users[str(user.id)]["bag"] for thing in inv: reqitem = "fishingpole" if thing["item"] == reqitem: if thing["amount"]>0: a = random.randrange(1,10000) if a<= 9500 and a>9000: await ctx.reply("You went to catch some fish but came back empty handed, Feels bad man") await update_bank(ctx.author,0) return elif a <= 4000: await ctx.reply("You went to catch some fish and you caught a common fish!") await get_item(ctx.author, 'common-fish', 1) return elif a <= 6000 and a>4000 : await ctx.reply("You went to catch some fish and you found a uncommon fish!") await get_item(ctx.author, 'uncommon-fish', 1) return elif a <= 9500 and a>9000: await ctx.reply("You went to catch some fish and you found a rare fish!") await get_item(ctx.author, 'rare-fish', 1) return elif a<= 9900 and a> 9800: await ctx.reply("You went to catch some fish and you caught a epic fish!") await get_item(ctx.author, 'epic-fish', 1) return elif a == 6: await ctx.send('TEST') if thing["amount"]<1: ctx.command.reset_cooldown(ctx) await ctx.send(f"{ctx.author.mention}, Buy a fishing rod to start fishing") async def get_item(user,item_name,amount): item_name = item_name.lower() name_ = None for item in sellable_items: name = item["name"].lower() if name == item_name: name_ = name price = item["price"] break if name_ == None: return [False,1] users = await get_bank_data() try: index = 0 t = None for thing in users[str(user.id)]["bag"]: n = thing["item"] if n == item_name: old_amt = thing["amount"] new_amt = old_amt + amount users[str(user.id)]["bag"][index]["amount"] = new_amt t = 1 break index+=1 if t == None: obj = {"item":item_name , "amount" : amount} users[str(user.id)]["bag"].append(obj) except: obj = {"item":item_name , "amount" : amount} users[str(user.id)]["bag"] = [obj] with open("mainbank.json","w") as f: json.dump(users,f) #================hunting command================================ return [True,"Worked"] @client.command() @commands.cooldown(1, 45, commands.BucketType.user) async def hunt(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() inv = users[str(user.id)]["bag"] for thing in inv: reqitem = "woodensword" if thing["item"] == reqitem: if thing["amount"]>0: a = random.randrange(1,10000) if a<= 9500 and a>9000: await ctx.reply("You went to hunt some animals but came back empty handed, Feels bad man") await update_bank(ctx.author,0) return elif a<= 9900 and a> 9800: await ctx.reply("You went to hunt some animals and caught a boar!") await get_item(ctx.author, 'boar', 1) return elif a<=9900 and a> 9800: await ctx.reply("You went to hunt some animals and caught a Snake holy freak!!") await get_item(ctx.author, 'snake', 1) return elif a <= 9500 and a>9000: await ctx.reply("You went to hunt some animals and caught a deer!") await get_item(ctx.author, 'deer', 1) return elif a <= 6000 and a>4000: await ctx.reply("You went to hunt some animals and caught a rabbit!") await get_item(ctx.author, 'rabbit', 1) return elif a <= 4000: await ctx.reply("You went to hunt some animals and caught a duck!") await get_item(ctx.author, 'duck', 1) return if thing["amount"]<1: ctx.command.reset_cooldown(ctx) await ctx.send(f"{ctx.author.mention}, Buy a wooden sword to start fishing") #================choping commands================================ @client.command() @commands.cooldown(1, 45, commands.BucketType.user) async def chop(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() inv = users[str(user.id)]["bag"] for thing in inv: reqitem = "axe" if thing["item"] == reqitem: if thing["amount"]>0: a = random.randrange(1,10000) if a<= 9500 and a>9000: await ctx.reply("You went to chop some trees but came back empty handed, Feels bad man") await update_bank(ctx.author,0) return elif a <= 4000: await ctx.reply("You went to chop some trees and you found a oak tree and chop it for a oak-wood") await get_item(ctx.author, 'oak-wood', 1) return elif a <= 6000 and a>4000 : await ctx.reply("You went to chop some trees and you found a birch tree and chop it for a birch-wood") await get_item(ctx.author, 'brich-wood', 1) return elif a <= 9500 and a>9000: await ctx.reply("You went to chop some trees and you found a jungle tree and chop it for a jungle-wood") await get_item(ctx.author, 'jungle-wood', 1) return elif a<= 9900 and a> 9800: await ctx.reply("You went to chop some trees and you found a dark tree and chop it for a dark-wood") await get_item(ctx.author, 'dark-wood', 1) return elif a<= 9900 and a> 9800: await ctx.reply("You went to chop some trees and you found a maple tree and chop it for a maple-wood") await get_item(ctx.author, 'maple-wood', 1) return elif a == 6: await ctx.send('TEST') if thing["amount"]<1: ctx.command.reset_cooldown(ctx) await ctx.send(f"{ctx.author.mention}, Buy a fishing rod to start fishing") #================mining commands================================ @client.command() async def mine(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() inv = users[str(user.id)]["bag"] for thing in inv: reqitem = "pickaxe" if thing["item"] == reqitem: if thing["amount"]>0: a = random.randrange(1,10000) if a<= 9500 and a>9000: await ctx.reply("You went to mine some ores but came back empty handed, Feels bad man") await update_bank(ctx.author,0) return elif a <= 4000: await ctx.reply("You went to mine some ores and found 1 stone") await get_item(ctx.author, 'stone', 1) return elif a <= 6000 and a>4000 : await ctx.reply("You went to mine some ores and found a coal") await get_item(ctx.author, 'coal', 1) return elif a <= 9500 and a>9000: await ctx.reply("You went to mine some ores and found a copper ore") await get_item(ctx.author, 'copper-ore', 1) return elif a<= 9900 and a> 9800: await ctx.reply("You went to mine some ores and found a iron ore a") await get_item(ctx.author, 'iron-ore', 1) return elif a<= 9900 and a> 9800: await ctx.reply("You went to mine some crystals and found a quartz") await get_item(ctx.author, 'quartz', 1) return elif a == 6: await ctx.send('TEST') if thing["amount"]>1: ctx.command.reset_cooldown(ctx) await ctx.send(f"{ctx.author.mention}, Buy a fishing rod to start fishing") #================admin commands================================ @client.command(aliases=["rm","takemoney","tm"]) async def removemoney(ctx,member:discord.Member,amount = None): if ctx.author.id == 671635704811618305: await open_account(member) if amount == None: await ctx.send(f"How much money do you want me to remove from {member.name}'s account?") return bal = await update_bank(ctx.author) amount = int(amount) if amount < 0: await ctx.send("amount MUST be positive...") return await update_bank(member,-1*amount, "bank") else: await ctx.send("You are not allowed to execute this command") #================shop command================================ @client.command() async def shop(ctx): em=discord.Embed(title="Shop", color=(0x25f7e2)) for item in mainshop: name=item["name"] price=item["price"] desc=item["description"] em.add_field(name=f"{name}- ${price}", value=f" | {desc}", inline=False) await ctx.send(embed=em) @client.command() async def buy(ctx,item,amount = 1): await open_account(ctx.author) res = await buy_this(ctx.author,item,amount) if not res[0]: if res[1]==1: await ctx.send("That Object isn't there!") return if res[1]==2: await ctx.send(f"You don't have enough money in your wallet to buy {amount} {item}") return await ctx.send(f"You just bought {amount} {item}") #================test================================ @client.command() async def sup(ctx): global times_used await ctx.send(f"y or n") # This will make sure that the response will only be registered if the following # conditions are met: def check(msg): return msg.author == ctx.author and msg.channel == ctx.channel and \ msg.content.lower() in ["f","r","n","c","w"] msg = await client.wait_for("message", check=check) if msg.content.lower() == "f": await ctx.send("you chosed fresh meme") elif msg.content.lower() == "r": await ctx.send("you chosed reposted meme") elif msg.content.lower() == "n": await ctx.send("you chosed nerdy meme") elif msg.content.lower() == "c": await ctx.send("you chosed cursed meme") elif msg.content.lower() == "w": await ctx.send("you chosed Wholesome meme") #================inventory command================================ times_used = times_used + 1 @client.command() async def bag(ctx): await open_account(ctx.author) user = ctx.author users = await get_bank_data() try: bag = users[str(user.id)]["bag"] except: bag = [] em = discord.Embed(title = "Bag", description="item name | quantity") for item in bag: name = item["item"] amount = item["amount"] em.add_field(name = f"{name} | {amount}", value ="danm",inline=False) await ctx.send(embed = em) async def buy_this(user,item_name,amount): item_name = item_name.lower() name_ = None for item in mainshop: name = item["name"].lower() if name == item_name: name_ = name price = item["price"] break if name_ == None: return [False,1] cost = price*amount users = await get_bank_data() bal = await update_bank(user) if bal[0]0: a = random.randint(1,3) if a == 1: await ctx.reply(f"Your meme went Viral! You got {random_number2} dollars from the Ad revenue!") await update_bank(ctx.author,random_number2) return if a == 2: await ctx.reply(f"Your meme got a decent response. You earned {random_number} dollars from the Ad Revenue.") await update_bank(ctx.author,random_number) return if a == 3: await ctx.reply("Bruh your meme sucks. You got nothingπŸ‘Ž") await update_bank(ctx.author,0) return #================admin command================================ @client.command(aliases=["am","givemoney","gm"]) async def addmoney(ctx,member:discord.Member = None,amount = None): if ctx.author.id == 671635704811618305: if member == ctx.author: await ctx.send("No :)") return await open_account(member) if amount == None: await ctx.send(f"How much money do you want me to add to {member.name}'s account?") return if member == None: await ctx.send("who do you want to give the money to?") bal = await update_bank(ctx.author) amount = int(amount) if amount < 0: await ctx.send("amount MUST be positive...") return await update_bank(member,amount, "bank") await ctx.send(f"you just added {amount} to {member} balance!") else: await ctx.send("You are not allowed to execute this command") #=====================daily commands========================================= @client.command(aliases=["daily"]) async def daily_money(ctx): await open_account(ctx.author) users = await get_bank_data() user = ctx.author if users[str(user.id)]["last_daily"] == 0: users[str(user.id)]["last_daily"] = int(time.time()) users[str(user.id)]["wallet"] += 100 with open("mainbank.json","w") as f: json.dump(users,f) await ctx.send("You just got 100 dollars from the daily money!") else: last_daily = users[str(user.id)]["last_daily"] now = int(time.time()) if now - last_daily < 86400: await ctx.send("You already got your daily money!") else: users[str(user.id)]["last_daily"] = int(time.time()) users[str(user.id)]["wallet"] += 100 with open("mainbank.json","w") as f: json.dump(users,f) await ctx.send("You just got 100 dollars from the daily money!") keep_alive() client.run("token") """π•„π•’π•šπ•Ÿπ•“π•’π•Ÿπ•œ.π•›π•€π• π•Ÿ""" {"620182789173542922": {"wallet": 871499, "bank": 8900078, "last_daily": 0, "bag": [{"item": "fishingpole", "amount": 1}, {"item": "woodensword", "amount": 1}, {"item": "laptop", "amount": 1}, {"item": "watch", "amount": 1}, {"item": "pc", "amount": 1}, {"item": "phone", "amount": 1}, {"item": "axe", "amount": 2}, {"item": "pickaxe", "amount": 2}, {"item": "uncommon-fish", "amount": 2}, {"item": "stone", "amount": 1}, {"item": "oak-wood", "amount": 1}, {"item": "rabbit", "amount": 1}, {"item": "epic-fish", "amount": 1}, {"item": "coal", "amount": 1}]}, "671635704811618305": {"wallet": 105764.0, "bank": 78632394, "last_daily": 1650742799, "bag": [{"item": "laptop", "amount": 1}, {"item": "fishingpole", "amount": 1}, {"item": "woodensword", "amount": 1}, {"item": "pickaxe", "amount": 1}, {"item": "axe", "amount": 1}, {"item": "phone", "amount": 1}, {"item": "common-fish", "amount": 3}, {"item": "uncommon-fish", "amount": 4}, {"item": "duck", "amount": 0}, {"item": "rabbit", "amount": 1}, {"item": "oak-wood", "amount": 1}, {"item": "stone", "amount": 0}]}, "724275771278884906": {"wallet": 100, "bank": 90100, "last_daily": 0, "bag": [{"item": "fishingpole", "amount": 1}]}, "795607989921906728": {"wallet": -112, "bank": 100000000, "last_daily": 0}, "370910692989206542": {"wallet": 165.0, "bank": 990000, "last_daily": 0, "bag": [{"item": "fishingpole", "amount": 0}, {"item": "uncommon-fish", "amount": 0}, {"item": "common-fish", "amount": 0}, {"item": "woodensword", "amount": 1}, {"item": "duck", "amount": 0}]}, "580087537822072842": {"wallet": 0, "bank": 90000, "last_daily": 0, "bag": [{"item": "fishingpole", "amount": 1}]}, "713557264107176019": {"wallet": 45000, "bank": 0, "last_daily": 0, "bag": [{"item": "pickaxe", "amount": 1}, {"item": "axe", "amount": 1}]}, "713119457471627325": {"wallet": 100, "bank": 0, "last_daily": 1650742749,"bag":[]}