original_docstring: Perform checks on a member and bounce or ban them if necessary.
  
          Ratelimits (thresholds) are also checked in this method.
          
docstring: Perform checks on a member and bounce or ban them if necessary.
  Ratelimits (thresholds) are also checked in this method.
docstring_tokens: Perform checks on a member and bounce or ban them if necessary . Ratelimits ( thresholds ) are also checked in this method .
code: async def check(self, member: discord.Member) -> bool:
          """Perform checks on a member and bounce or ban them if necessary.
  
          Ratelimits (thresholds) are also checked in this method.
          """
          self.log.debug("%d: gatekeeping! (created_at=%s)", member.id, member.created_at)
  
          if self.unique_join_ratelimiter and self.unique_join_ratelimiter.hit(member.id):
              # user is joining too fast!
              await self._unique_joining_too_quickly_ban(member)
              return False
  
          async def handle_misconfiguration(report):
              self.log.debug("error in config: %r", report)
              await self.report(str(report))
              await self.bounce(member, INCORRECTLY_CONFIGURED_STRING)
  
          # perform bannable checks
          try:
              bannable_checks = self.config.get("bannable_checks", {})
              await self._perform_checks(member, bannable_checks)
          except CheckFailure as error:
              self.log.debug(
                  '%d: banning, failed to pass bannable checks (failed "%s", err=%r)',
                  member.id,
                  error.check_name,
                  error,
              )
              await self.ban(member, str(error))
              return False
          except Report as report:
              await handle_misconfiguration(report)
              return False
  
          # perform regular checks
          try:
              enabled_checks = self.config.get("checks", {})
              await self._perform_checks(member, enabled_checks)
          except Ban as ban:
              self.log.debug("%d: banning (err=%r)", member.id, ban)
              await self.ban(member, str(ban))
              return False
          except Bounce as bounce:
              self.log.debug(
                  '%d: failed to pass "%s" (err=%r)', member.id, bounce.check_name, bounce
              )
              await self.bounce(member, str(bounce))
              return False
          except Report as report:
              await handle_misconfiguration(report)
              return False
  
          if self.join_ratelimiter and self.join_ratelimiter.hit():
              # users are joining too fast!
              self.log.debug("users are joining too quickly")
              await self._auto_lockdown(member)
              return False
  
          # prevent this list from growing too large
          # TODO: we should just check if the join ratelimiter has expired and
          #       empty the list if so
          if self.join_ratelimiter:
              if len(self.recent_joins) >= self.join_ratelimiter.rate + 5:
                  self.recent_joins.pop(0)
              self.recent_joins.append(member)
  
          self.log.debug("%d: passed all checks", member.id)
          return True
code_tokens: async def check ( self , member : discord . Member ) -> bool : self . log . debug ( "%d: gatekeeping! (created_at=%s)" , member . id , member . created_at ) if self . unique_join_ratelimiter and self . unique_join_ratelimiter . hit ( member . id ) : await self . _unique_joining_too_quickly_ban ( member ) return False async def handle_misconfiguration ( report ) : self . log . debug ( "error in config: %r" , report ) await self . report ( str ( report ) ) await self . bounce ( member , INCORRECTLY_CONFIGURED_STRING ) try : bannable_checks = self . config . get ( "bannable_checks" , { } ) await self . _perform_checks ( member , bannable_checks ) except CheckFailure as error : self . log . debug ( '%d: banning, failed to pass bannable checks (failed "%s", err=%r)' , member . id , error . check_name , error , ) await self . ban ( member , str ( error ) ) return False except Report as report : await handle_misconfiguration ( report ) return False try : enabled_checks = self . config . get ( "checks" , { } ) await self . _perform_checks ( member , enabled_checks ) except Ban as ban : self . log . debug ( "%d: banning (err=%r)" , member . id , ban ) await self . ban ( member , str ( ban ) ) return False except Bounce as bounce : self . log . debug ( '%d: failed to pass "%s" (err=%r)' , member . id , bounce . check_name , bounce ) await self . bounce ( member , str ( bounce ) ) return False except Report as report : await handle_misconfiguration ( report ) return False if self . join_ratelimiter and self . join_ratelimiter . hit ( ) : self . log . debug ( "users are joining too quickly" ) await self . _auto_lockdown ( member ) return False if self . join_ratelimiter : if len ( self . recent_joins ) >= self . join_ratelimiter . rate + 5 : self . recent_joins . pop ( 0 ) self . recent_joins . append ( member ) self . log . debug ( "%d: passed all checks" , member . id ) return True
short_docstring: Perform checks on a member and bounce or ban them if necessary.
short_docstring_tokens: Perform checks on a member and bounce or ban them if necessary .
comment: """Perform checks on a member and bounce or ban them if necessary.
  
          Ratelimits (thresholds) are also checked in this method.
          """$SEP$# user is joining too fast!$SEP$# perform bannable checks$SEP$# perform regular checks$SEP$# users are joining too fast!$SEP$# prevent this list from growing too large$SEP$# TODO: we should just check if the join ratelimiter has expired and$SEP$#       empty the list if so