コード例 #1
0
    async def apply(self):
        data = MasterData.getInstance()
        user = data.get_user_email(self.email)
        if user is None:
            await self.ctx.send("Whoops, the email is wrong. Are you sure you used this email to register to "
                                "BitsxLaMaratò?")
        elif user.is_logged():
            await self.ctx.send("You were already logged in")
        else:
            data.login(self.author.id, user)
            data.save_data()
            hacker_role = get(self.guild.roles, name='Hackers')
            await self.author.add_roles(hacker_role)
            await self.ctx.send(("Hi %s, you have registered BitsxLaMaratò!" % user.name))
            if user.is_fib():
                await self.ctx.send("UPC email detected!")
            else:
                await self.ctx.send("Are you studying at FIB UPC? Register now your university email with the "
                                    "command: bits!FIBAddEmail [email protected]")
            if user.has_team:
                await self.ctx.send(("Team detected! Joining %s" % user.team))
                team_role = get(self.guild.roles, name=user.team)
                if team_role is not None:
                    await self.author.add_roles(team_role)
                else:
                    team_role = await create_team(guild=self.guild, team=user.team)

                    await self.author.add_roles(team_role)

                    await self.ctx.send("You are ready to go")
            else:
                await self.author.send("You have no team. :(\nYou can go and take a look at the #search_team channel")
コード例 #2
0
ファイル: user.py プロジェクト: hackupc/discordbot-bitsbot
 async def apply(self):
     data = MasterData.getInstance()
     user = data.get_user_email(self.email)
     if user is None:
         await self.author.send("User not logged in")
     else:
         await self.author.send("User logged in")
コード例 #3
0
 async def apply(self):
     data = MasterData.getInstance()
     user = data.get_user_dc(self.author.id)
     if user.is_fib():
         await self.ctx.send("Your email is already added")
     elif UNIVERSITY_EMAIL in self.email:
         user.add_fib_mail(self.email)
         await self.ctx.send("UPC email added!")
     else:
         await self.ctx.send("Wrong UPC email format")
コード例 #4
0
ファイル: email.py プロジェクト: hackupc/discordbot-bitsbot
 async def apply(self):
     data = MasterData.getInstance()
     user_author = data.get_user_dc(self.user_id)
     if user_author is None:
         await self.author.send("User not logged in")
     else:
         await self.author.send(
             ("Email: %s \n" % user_author.email) +
             (("UPC email: %s \n" % user_author.email_uni) if user_author.is_fib() else "")
         )
コード例 #5
0
 async def apply(self):
     data = MasterData.getInstance()
     user = data.get_user_dc(self.author.id)
     if get(self.guild.roles, name=self.team) is not None:
         await self.ctx.send("This team already exists")
     elif user.has_team:
         await self.ctx.send("You already have a team")
     else:
         user.add_team(self.team)
         team_role = await create_team(guild=self.guild, team=user.team)
         await self.author.add_roles(team_role)
         data.save_data()
         await self.ctx.send("Team %s created" % self.team)
コード例 #6
0
 async def apply(self):
     data = MasterData.getInstance()
     user_author = data.get_user_dc(self.user_id)
     if user_author is None:
         await self.author.send("User not logged in")
     else:
         await self.author.send(
             ("Name: %s \n" % user_author.name) +
             ("Last Name: %s \n" % user_author.last_name) +
             ("Email: %s \n" % user_author.email) +
             (("UPC email: %s \n" %
               user_author.email_uni) if user_author.is_fib() else "") +
             ("Has team: %s \n" %
              ("Yes" if user_author.has_team else "No")) +
             (("Team: %s \n" %
               user_author.team) if user_author.has_team else ""))
コード例 #7
0
 async def apply(self):
     data = MasterData.getInstance()
     texts = data.get_logged_emails()
     if not texts:
         await self.author.send("No one is logged in")
     else:
         lines = texts.split("\n")
         text_to_send = ""
         i = 0
         for line in lines:
             if i <= 5:
                 text_to_send += (line + "\n")
                 i += 1
             else:
                 await self.author.send(text_to_send)
                 text_to_send = ""
                 i = 0
         if i != 0:
             await self.author.send(text_to_send)
コード例 #8
0
 async def apply(self):
     data = MasterData.getInstance()
     user_author = data.get_user_dc(self.author.id)
     dc_user_target = get(self.guild.members, id=self.user_id)
     user_taget = data.get_user_dc(self.author.id)
     team_role = get(self.guild.roles, name=user_author.team)
     if user_author is None:
         await self.ctx.send("Log in into bitsxLaMaratò 2020")
     elif team_role is None:
         await self.ctx.send(
             "You have no team, search one first or create it")
     elif dc_user_target is None:
         await self.ctx.send(
             "The user is incorrect. You have to mention the user with @")
     elif user_taget.has_team:
         await self.ctx.send("The user you mentioned has already a team")
     else:
         user_taget.addTeam(user_author.team.name)
         data.save_data()
         await dc_user_target.add_roles(team_role)
         await self.ctx.send("Member joined the %s team successfully" %
                             user_author.team.name)