Filter system message
This commit is contained in:
parent
4410fe1232
commit
2811117211
2 changed files with 8 additions and 4 deletions
|
@ -57,7 +57,12 @@ def getAllChannels(rocket):
|
||||||
return allChannels
|
return allChannels
|
||||||
|
|
||||||
def getAllMessages(rocket, roomid, begindate=None, enddate=None):
|
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__":
|
if __name__ == "__main__":
|
||||||
print("Ce fichier est juste une librarie")
|
print("Ce fichier est juste une librarie")
|
|
@ -46,7 +46,6 @@ def main():
|
||||||
|
|
||||||
messages = getAllMessages(rocket, channel["_id"], begindate= recent_date)
|
messages = getAllMessages(rocket, channel["_id"], begindate= recent_date)
|
||||||
|
|
||||||
messages = list(filter(lambda message: "t" not in message, messages["messages"]))
|
|
||||||
nbMessages = len(messages)
|
nbMessages = len(messages)
|
||||||
print("Check messages for channels {} ({})".format(channel['name'], nbMessages))
|
print("Check messages for channels {} ({})".format(channel['name'], nbMessages))
|
||||||
messages_recent += nbMessages
|
messages_recent += nbMessages
|
||||||
|
|
Loading…
Reference in a new issue