diff --git a/rocketchat_API/APISections/channels.py b/rocketchat_API/APISections/channels.py index 3b616f4..e29dcef 100644 --- a/rocketchat_API/APISections/channels.py +++ b/rocketchat_API/APISections/channels.py @@ -1,3 +1,5 @@ +import json + from rocketchat_API.APIExceptions.RocketExceptions import RocketMissingParamException from rocketchat_API.APISections.base import RocketChatBase @@ -242,7 +244,7 @@ def channels_counters(self, room_id=None, room_name=None, **kwargs): ) raise RocketMissingParamException("room_id or room_name required") - def channels_online(self, _id): + def channels_online(self, query): """Lists all online users of a channel if the channel's id is provided, otherwise it gets all online users of all channels.""" - return self.call_api_get("channels.online", _id=_id) + return self.call_api_get("channels.online", query=json.dumps(query)) diff --git a/tests/test_channels.py b/tests/test_channels.py index aa7486f..c85c2b9 100644 --- a/tests/test_channels.py +++ b/tests/test_channels.py @@ -377,6 +377,6 @@ def test_channels_counters(logged_rocket): def test_channels_online(logged_rocket): - channels_online = logged_rocket.channels_online(_id="GENERAL").json() + channels_online = logged_rocket.channels_online(query={"_id": "GENERAL"}).json() assert channels_online.get("success") - assert channels_online.get("online") == [] + assert len(channels_online.get("online")) >= 1