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'])
|
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")
|
print("Check users")
|
||||||
users = rocket.users_list().json()
|
users = getAllActiveUsers(rocket)
|
||||||
|
crapauds_total = len(users)
|
||||||
crapauds_total = users["total"]
|
|
||||||
|
|
||||||
print("Check channels")
|
print("Check channels")
|
||||||
channels = getAllChannels(rocket)
|
channels = getAllChannels(rocket)
|
||||||
|
@ -101,7 +100,7 @@ def getAllChannels(rocket):
|
||||||
index += channels['count']
|
index += channels['count']
|
||||||
return allChannels
|
return allChannels
|
||||||
|
|
||||||
def getAllUsers(rocket):
|
def getAllActiveUsers(rocket):
|
||||||
index = 0
|
index = 0
|
||||||
allUsers = []
|
allUsers = []
|
||||||
while True:
|
while True:
|
||||||
|
@ -111,7 +110,7 @@ def getAllUsers(rocket):
|
||||||
if users['count'] + users['offset'] >= users['total']:
|
if users['count'] + users['offset'] >= users['total']:
|
||||||
break
|
break
|
||||||
index += users['count']
|
index += users['count']
|
||||||
return allUsers
|
return list(filter( lambda user: user["active"] ,allUsers))
|
||||||
|
|
||||||
def getAllMessages(rocket, roomid, begindate):
|
def getAllMessages(rocket, roomid, begindate):
|
||||||
index = 0
|
index = 0
|
||||||
|
|
Loading…
Reference in a new issue