def rpc_banUser(self, userId, duration, reason):
        """
        Summary:
            Bans the user associated with the provided [userId] for the
            specified [duration].

        Parameters:
            [int/str userId] = The ID of the user to ban.
            [int duration] = The ban's duration in hours. If this is 0 or less,
                the user will be permanently banned.
            [str reason] = A short description of why this user is being
                banned. This can be one of the following values: 'hacking',
                'language', 'other'.

        Example response:
            On success: True
            On failure: False
        """
        if reason not in ('hacking', 'language', 'other'):
            return False
        self.air.writeServerEvent('ban', userId, duration, reason)
        if duration > 0:
            now = datetime.date.today()
            release = str(now + datetime.timedelta(hours=duration))
        else:
            release = '0000-00-00'  # Permanent ban.
        executeHttpRequest('accounts/ban/', Id=userId, Release=release,
                           Reason=reason)
        self.rpc_kickUser(userId, 152, reason)
        return True
 def performBan(self, bannedUntil):
     executeHttpRequest('accounts/ban/', Id=self.accountId, Release=bannedUntil,
                        Reason=self.comment)
Exemple #3
0
 def performBan(self, bannedUntil):
     executeHttpRequest('accounts/ban/',
                        Id=self.accountId,
                        Release=bannedUntil,
                        Reason=self.comment)