filter system message on last message

This commit is contained in:
Mickael 2019-08-26 19:08:22 +02:00
parent 941cbba66d
commit fd2b60bfe8

View file

@ -42,11 +42,12 @@ def main():
print("Check messages for channels {}".format(channel['name'])) print("Check messages for channels {}".format(channel['name']))
messages = rocket.channels_history(channel["_id"], oldest= recent_date, count= 10000).json() messages = rocket.channels_history(channel["_id"], oldest= recent_date, count= 10000).json()
if messages["success"]: if messages["success"]:
nbMessages = len(messages["messages"]) messages = list(filter(lambda message: "t" not in message, messages["messages"]))
nbMessages = len(messages)
messages_recent += nbMessages messages_recent += nbMessages
if (channel["name"] != "general") and (channel["name"] != "accueil"): if (channel["name"] != "general") and (channel["name"] != "accueil"):
channels_list.append((channel["name"], nbMessages)) channels_list.append((channel["name"], nbMessages))
users.extend(map(lambda message: message["u"]["_id"], messages["messages"])) users.extend(map(lambda message: message["u"]["_id"], messages))
else: else:
print("Error : {}".format(messages["error"])) print("Error : {}".format(messages["error"]))