cut()payout()balance() done
This commit is contained in:
parent
bc3061ac92
commit
d65946d8b0
13
README.md
13
README.md
@ -1,8 +1,3 @@
|
||||
## Ahoj functions
|
||||
- [ ] The whole Ahoj think
|
||||
- [ ] Case sensitivity
|
||||
- [ ] Use it on vulgare talk
|
||||
|
||||
## Permisions
|
||||
- [ ] Close bot in specific chanel
|
||||
- [ ] Discord permitions
|
||||
@ -15,10 +10,4 @@
|
||||
|
||||
## Funkce
|
||||
- [ ] tajne si zjistit svuj balance (do DM)
|
||||
|
||||
## ToDO
|
||||
- [ ] payout()
|
||||
- [ ] to cut it from who
|
||||
- [ ] to autoset how much
|
||||
- [ ] cut()
|
||||
- [ ] check_role() awiat bug
|
||||
- [ ] leaderboard
|
||||
|
||||
54
disbot.py
54
disbot.py
@ -29,38 +29,65 @@ async def ahoj(ctx):
|
||||
|
||||
|
||||
@bot.command()
|
||||
async def balance(ctx):
|
||||
async def balance(ctx, member:discord.Member = "neni"):
|
||||
# test if acount is opend and makes on if not
|
||||
await open_account(ctx.author)
|
||||
|
||||
user = ctx.author
|
||||
if member == "neni":
|
||||
member = ctx.author
|
||||
|
||||
if member != ctx.author:
|
||||
|
||||
role = await check_role(ctx, ctx.author)
|
||||
|
||||
if role == False:
|
||||
await ctx.send("Větší snahy ze strany tvé nastati budou než já podlehnu.")
|
||||
return
|
||||
|
||||
users = await get_bank_data()
|
||||
|
||||
wallet_amt = users[str(user.id)]["wallet"]
|
||||
wallet_amt = users[str(member.id)]["wallet"]
|
||||
|
||||
em = discord.Embed(title = f"{ctx.author.name}'s balance",color = discord.Color.red())
|
||||
em.add_field(name = "Wallet balance", value = wallet_amt)
|
||||
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()
|
||||
# Payout command
|
||||
# from who???? TODO!
|
||||
async def payout(ctx,member:discord.Member,amount = None):
|
||||
|
||||
await open_account(member)
|
||||
|
||||
role = await check_role(ctx, ctx.author)
|
||||
|
||||
if amount == None:
|
||||
await ctx.send("Plese enter the amount")
|
||||
await ctx.send("Částku zapoměl napsat jsi.")
|
||||
return
|
||||
|
||||
if check_role(ctx, member) == False:
|
||||
await ctx.send("Good try my man")
|
||||
if check_role(ctx, member):
|
||||
if role == False:
|
||||
await ctx.send("Já nevěřit tvým šprímům, ty více ukázati musíš.")
|
||||
if role:
|
||||
await update_bank(member,amount)
|
||||
|
||||
await ctx.send(f"You gave {member} {amount} coins!")
|
||||
await ctx.send(f"{member} dostal vyplaceno {amount} bodíčků!")
|
||||
|
||||
@bot.command()
|
||||
async def cut(ctx,member:discord.Member,amount = None):
|
||||
|
||||
await open_account(member)
|
||||
|
||||
role = await check_role(ctx, ctx.author)
|
||||
|
||||
if amount == None:
|
||||
await ctx.send("Částku zapoměl napsat jsi.")
|
||||
return
|
||||
|
||||
if role == False:
|
||||
await ctx.send("Já nevěřit tvým šprímům, ty více ukázati musíš.")
|
||||
if role:
|
||||
await update_bank(member,int(amount)*-1)
|
||||
|
||||
await ctx.send(f"{member} dostal zabaveno {amount} bodíčků!")
|
||||
|
||||
# TODO! cut
|
||||
|
||||
async def open_account(user):
|
||||
# opens json file to found if user id is present
|
||||
@ -109,3 +136,4 @@ async def check_role(ctx, user:discord.Member):
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
{"412092791733354521": {"wallet": 660}, "232593965910720514": {"wallet": 100}}
|
||||
{"412092791733354521": {"wallet": 829}, "232593965910720514": {"wallet": 10136}, "1297253398349090816": {"wallet": 100}}
|
||||
Loading…
x
Reference in New Issue
Block a user