Skip to content

Commit 69584e6

Browse files
authored
Merge pull request #15 from notsniped/currencyframework-rob
Add `rob` command
2 parents 7d693d0 + 279e525 commit 69584e6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

main.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,5 +377,32 @@ async def give(ctx:SlashContext, user:discord.User, amount:int):
377377
save()
378378
await ctx.send(f':gift: {ctx.author.mention} just gifted {amount} coins to {user.display_name}!')
379379

380+
@slash.slash(
381+
name='rob',
382+
description='Rob someone for their money',
383+
options=[
384+
create_option(name='user', description='The person you want to rob', option_type=6, required=True)
385+
]
386+
)
387+
async def rob(ctx:SlashContext, user:discord.User):
388+
chance:int = random.randint(1, 100)
389+
if (currency['wallet'][str(user.id)] < 5000):
390+
await ctx.reply('He has less than 5000 coins on him. Don\'t waste your time...')
391+
return
392+
elif (currency['wallet'][str(ctx.author.id)] < 5000):
393+
await ctx.reply('You have less than 5k coins in your wallet. Play fair dude.')
394+
return
395+
if (chance <= 50):
396+
x:int = random.randint(5000, currency['wallet'][str(user.id)])
397+
currency['wallet'][str(ctx.author.id)] += x
398+
currency['wallet'][str(user.id)] -= x
399+
await ctx.reply(f'You just stole {x} coins from {user.display_name}! Feels good, doesn\'t it?')
400+
else:
401+
x:int = random.randint(5000, currency['wallet'][str(ctx.author.id)])
402+
currency['wallet'][str(ctx.author.id)] -= x
403+
currency['wallet'][str(user.id)] += x
404+
await ctx.reply(f'LOL YOU GOT CAUGHT! You paid {user.display_name} {x} coins as compensation for your action.')
405+
save()
406+
380407
# Initialization
381408
client.run(api.auth.token)

0 commit comments

Comments
 (0)