diff --git a/rocketchat_API/APISections/groups.py b/rocketchat_API/APISections/groups.py index fc56bc4..a2c71e5 100644 --- a/rocketchat_API/APISections/groups.py +++ b/rocketchat_API/APISections/groups.py @@ -106,6 +106,15 @@ def groups_rename(self, room_id, name, **kwargs): "groups.rename", roomId=room_id, name=name, kwargs=kwargs ) + def groups_set_announcement(self, room_id, announcement, **kwargs): + """Sets the announcement for the private group.""" + return self.call_api_post( + "groups.setAnnouncement", + roomId=room_id, + announcement=announcement, + kwargs=kwargs, + ) + def groups_set_description(self, room_id, description, **kwargs): """Sets the description for the private group.""" return self.call_api_post( diff --git a/tests/test_groups.py b/tests/test_groups.py index 4b589ca..277643a 100644 --- a/tests/test_groups.py +++ b/tests/test_groups.py @@ -200,6 +200,17 @@ def test_groups_rename(logged_rocket): assert groups_rename.get("group").get("name") == name2 +def test_groups_set_announcement(logged_rocket, test_group_id): + announcement = str(uuid.uuid1()) + groups_set_announcement = logged_rocket.groups_set_announcement( + test_group_id, announcement + ).json() + assert groups_set_announcement.get("success") + assert ( + groups_set_announcement.get("announcement") == announcement + ), "Announcement does not match" + + def test_groups_set_description(logged_rocket, test_group_id): description = str(uuid.uuid1()) groups_set_description = logged_rocket.groups_set_description(