diff --git a/README.md b/README.md index ada1e4d..69d197b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ ## Permisions -- [ ] Close bot in specific chanel -- [ ] Discord permitions +- [x] Close bot in specific chanel +- [x] Discord permitions ## To learn -- [ ] Embeds learning +- [x] Embeds learning ## Token Security - [ ] how to import it ## Funkce -- [ ] tajne si zjistit svuj balance (do DM) -- [ ] leaderboard -- [ ] gamba ohledne bordelu +- [x] tajne si zjistit svuj balance (do DM) +- [x] kolikaty jsem v poradi + +## Cool tech +- [ ] mit json v cache pro rychlost diff --git a/disbot.py b/disbot.py index d5ea76d..a53eadc 100644 --- a/disbot.py +++ b/disbot.py @@ -28,10 +28,9 @@ async def ahoj(ctx): await ctx.send("Zdravím miláčkové!") -@bot.command() +@bot.command(aliases = ["bal"]) async def balance(ctx, member:discord.Member = "neni"): # test if acount is opend and makes on if not - await open_account(ctx.author) if member == "neni": member = ctx.author @@ -44,14 +43,50 @@ async def balance(ctx, member:discord.Member = "neni"): await ctx.send("Větší snahy ze strany tvé nastati budou než já podlehnu.") return + await open_account(ctx.author) + await open_account(member) + users = await get_bank_data() wallet_amt = users[str(member.id)]["wallet"] + + leader_board = {} + total = [] + + for user in users: + name = int(user) + leader_board[users[user]["wallet"]] = name + total.append([users[user]["wallet"]]) + + total = sorted(total, reverse=True) + poradi = total.index([users[str(member.id)]["wallet"]]) +1 + + + em = discord.Embed(title = f"{member.name}",color = discord.Color.blue()) + em.add_field(name = "Bodíčků máš", value = wallet_amt, inline = False) + em.add_field(name = "V poradi jsi:", value = poradi, inline = False) + em.set_thumbnail(url = member.avatar) + + await ctx.send("Co bych pro tebe neudělal!") + await ctx.author.send(embed = em) +""" +@bot.command() +async def leaderboard(ctx, x = 3) + users = await get_bank_data() + leader_board = {} + total = [] + + for user in users: + name = int(user) + leader_board[users[user]["wallet"]] = name + total.append([users[user]["wallet"]]) + + total = sorted(total, reverse=True) + + print +""" + - em = discord.Embed(title = f"{member.name} bodíčky",color = discord.Color.red()) - em.add_field(name = "Bodíčků máš", value = wallet_amt) - await ctx.send(embed = em) - @bot.command() async def payout(ctx,member:discord.Member,amount = None): @@ -136,4 +171,3 @@ async def check_role(ctx, user:discord.Member): else: return False - diff --git a/mainbank.json b/mainbank.json index 66760bc..e27c83b 100644 --- a/mainbank.json +++ b/mainbank.json @@ -1 +1 @@ -{"412092791733354521": {"wallet": 829}, "232593965910720514": {"wallet": 9136}, "1297253398349090816": {"wallet": 100}, "689788136301133839": {"wallet": 100}} \ No newline at end of file +{"412092791733354521": {"wallet": 829}, "232593965910720514": {"wallet": 9136}, "1297253398349090816": {"wallet": 100}, "689788136301133839": {"wallet": 10000000000000}, "775434826126852148": {"wallet": 100}, "1280096437597765674": {"wallet": 1100}, "871341579607109683": {"wallet": 100}} \ No newline at end of file