Set now by default

This commit is contained in:
Mickael 2019-09-01 19:21:42 +02:00
parent b5dfd3426c
commit 021346b53f
2 changed files with 3 additions and 2 deletions

View file

@ -1,4 +1,5 @@
from rocketchat_API.rocketchat import RocketChat from rocketchat_API.rocketchat import RocketChat
from datetime import datetime
import os import os
def Connection(): def Connection():
@ -56,7 +57,7 @@ def getAllChannels(rocket):
index += channels['count'] index += channels['count']
return allChannels return allChannels
def getAllMessages(rocket, roomid, begindate=None, enddate=None): def getAllMessages(rocket, roomid, begindate=None, enddate=datetime.now()):
result = rocket.channels_history(roomid, oldest= begindate, latest= enddate, count= 10000).json() result = rocket.channels_history(roomid, oldest= begindate, latest= enddate, count= 10000).json()
if result["success"]: if result["success"]:
#filter system message #filter system message

View file

@ -44,7 +44,7 @@ def main():
if channel_date > recent_date: if channel_date > recent_date:
channels_recent += 1 channels_recent += 1
messages = getAllMessages(rocket, channel["_id"], begindate= recent_date, enddate = datetime.now()) messages = getAllMessages(rocket, channel["_id"], begindate= recent_date)
nbMessages = len(messages) nbMessages = len(messages)
print("Check messages for channels {} ({})".format(channel['name'], nbMessages)) print("Check messages for channels {} ({})".format(channel['name'], nbMessages))