Get only active user

This commit is contained in:
Mickael 2019-08-26 19:16:26 +02:00
parent fd2b60bfe8
commit 3069186812

View file

@ -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