From 021346b53f2efca76b53fbe5edb10111c4799431 Mon Sep 17 00:00:00 2001 From: Mickael Date: Sun, 1 Sep 2019 19:21:42 +0200 Subject: [PATCH] Set now by default --- scripts/common/rocketchathelper.py | 3 ++- scripts/generate_chat_info.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/common/rocketchathelper.py b/scripts/common/rocketchathelper.py index 86e0b14..e4b8927 100644 --- a/scripts/common/rocketchathelper.py +++ b/scripts/common/rocketchathelper.py @@ -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 diff --git a/scripts/generate_chat_info.py b/scripts/generate_chat_info.py index 9d9029c..4726252 100644 --- a/scripts/generate_chat_info.py +++ b/scripts/generate_chat_info.py @@ -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))