Filter system message

This commit is contained in:
Mickael 2019-09-01 16:52:19 +02:00
parent 4410fe1232
commit 2811117211
2 changed files with 8 additions and 4 deletions

View file

@ -57,7 +57,12 @@ def getAllChannels(rocket):
return allChannels
def getAllMessages(rocket, roomid, begindate=None, enddate=None):
return rocket.channels_history(roomid, oldest= begindate, count= 10000).json()
result = rocket.channels_history(roomid, oldest= begindate, latest= enddate, count= 10000).json()
if result["success"]:
#filter system message
return list(filter(lambda message: "t" not in message, result["messages"]))
return None
if __name__ == "__main__":
print("Ce fichier est juste une librarie")

View file

@ -45,8 +45,7 @@ def main():
channels_recent += 1
messages = getAllMessages(rocket, channel["_id"], begindate= recent_date)
messages = list(filter(lambda message: "t" not in message, messages["messages"]))
nbMessages = len(messages)
print("Check messages for channels {} ({})".format(channel['name'], nbMessages))
messages_recent += nbMessages