async def stop_the_heist(self, ctx): member_dto = MemberDto() member_dto.get_member(ctx.author.id) leader = MemberDto() leader.get_leader() thief = MemberDto() thief.get_thief() if member_dto.member_id != leader.member_id: await ctx.send( f'{ctx.author.mention}, Only the leader can defend the xp!') return time = datetime.datetime.now() - thief.steal_time if time.seconds > 10: await ctx.send( f'{ctx.author.mention}, You were too late to stop the thief!') return thief.steal_flag = 0 await thief.save(self.bot) await ctx.send( f'{ctx.author.mention} got home in time to stop the heist! ' f'{self.bot.get_user(thief.member_id).mention}, you can`t steal xp anymore!' )
async def steal(self, ctx): member_dto = MemberDto() member_dto.get_member(ctx.author.id) if member_dto.steal_flag != 1: await ctx.send( f'{ctx.author.mention}, You were not prepared to steal any xp!' ) return time = datetime.datetime.now() - member_dto.steal_time if time.seconds > 15: member_dto.steal_flag = 0 await member_dto.save(self.bot) await ctx.send( f'{ctx.author.mention}, You were caught stealing xp and lost 2 xp!' ) return xp_stolen = randrange(50) member_dto.steal_flag = 0 await member_dto.save(self.bot) leader = MemberDto() leader.get_leader() await member_dto.save(self.bot) await ctx.send( f'{ctx.author.mention} stole {xp_stolen} xp from {self.bot.get_user(leader.member_id).mention}!' )
async def steal_xp(self): member_dto = MemberDto() member_dto.reset_heist() leader_member_dto = member_dto.get_leader() thieves = member_dto.get_thieves(leader_member_dto) member_dto = random.choice(thieves) member_dto.steal_flag = 1 await member_dto.save(self.bot) channel = self.bot.get_channel(int(self.bot.channel)) await channel.send( f'{self.bot.get_user(member_dto.member_id).mention} ' f'you have 15 seconds to steal from the leader! Use !steal') await channel.send( f'{self.bot.get_user(leader_member_dto.member_id).mention} ' f'you have 10 seconds to defend your xp! Use !stop_the_heist')