Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DoubleOrNothing(BaseCog):
- """Doubles your money or destroys it!"""
- def __init__(self):
- self.last_work = {}
- @commands.group(autohelp=True)
- async def doubleorno(self, ctx: commands.Context):
- """Double or Nothing"""
- pass
- @doubleorno.command()
- async def bet(self, ctx: commands.Context, bet: int):
- """random number
- If you get 3 or below, all money lost
- If you get 4 or above, your money is doubled.
- """
- if bet < 200:
- return await ctx.send("You need to bet at least 200 credits.")
- else:
- await bank.withdraw_credits(ctx.author, bet)
- await ctx.send(str(bet) + " credits have been withdrawn out of your account")
- dice = random.randint(1, 6)
- if dice <=3:
- await ctx.send("Bad luck! You have lost " + str(bet) + " credits.")
- elif dice >= 4:
- await ctx.send("WOOHOO! YOU JUST DOUBLED YOUR BET!")
- wonmoney = bet + bet
- await bank.deposit_credits(ctx.author, wonmoney)
- await ctx.send(str(wonmoney) + " credits have been deposited. Happy spending!")
- await ctx.send("Note: When the fun stops, stop!")
- @commands.group(autohelp=True)
- async def job(self, ctx: commands.Context):
- """Core command; job. Get a job!"""
- pass
- @job.command()
- async def work(self, ctx: commands.Context):
- """Sub command of job. Start working at your job!"""
- jobpay = random.randint(1, 100)
- await ctx.send("You just worked at your job and earned " + str(jobpay) +" credits!")
- await bank.deposit_credits(ctx.author, jobpay)
- if ctx.message.author.id in self.last_work and time.time() - self.last_work[ctx.message.author.id] < X:
- await ctx.send("You must wait before running the command again")
- return
- self.last_work[ctx.message.author.id] = time.time()
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement