diff --git a/scripts/generate_chat_info.py b/scripts/generate_chat_info.py index 63a7b3a..38af7da 100644 --- a/scripts/generate_chat_info.py +++ b/scripts/generate_chat_info.py @@ -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