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 datetime import datetime
import os
def Connection():
@ -56,7 +57,7 @@ def getAllChannels(rocket):
index += channels['count']
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()
if result["success"]:
#filter system message

View file

@ -44,7 +44,7 @@ def main():
if channel_date > recent_date:
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)
print("Check messages for channels {} ({})".format(channel['name'], nbMessages))