Get only active user
This commit is contained in:
parent
fd2b60bfe8
commit
3069186812
1 changed files with 4 additions and 5 deletions
|
@ -21,9 +21,8 @@ def main():
|
|||
rocket = RocketChat(None, None, auth_token= os.environ['ROCKETCHAT_AUTH'], user_id= os.environ['ROCKETCHAT_USERID'], server_url=os.environ['ROCKETCHAT_SERVER'])
|
||||
|
||||
print("Check users")
|
||||
users = rocket.users_list().json()
|
||||
|
||||
crapauds_total = users["total"]
|
||||
users = getAllActiveUsers(rocket)
|
||||
crapauds_total = len(users)
|
||||
|
||||
print("Check channels")
|
||||
channels = getAllChannels(rocket)
|
||||
|
@ -101,7 +100,7 @@ def getAllChannels(rocket):
|
|||
index += channels['count']
|
||||
return allChannels
|
||||
|
||||
def getAllUsers(rocket):
|
||||
def getAllActiveUsers(rocket):
|
||||
index = 0
|
||||
allUsers = []
|
||||
while True:
|
||||
|
@ -111,7 +110,7 @@ def getAllUsers(rocket):
|
|||
if users['count'] + users['offset'] >= users['total']:
|
||||
break
|
||||
index += users['count']
|
||||
return allUsers
|
||||
return list(filter( lambda user: user["active"] ,allUsers))
|
||||
|
||||
def getAllMessages(rocket, roomid, begindate):
|
||||
index = 0
|
||||
|
|
Loading…
Reference in a new issue