Skip to content

Commit e980609

Browse files
committed
Release: v1.4.62
update part_size to 200mb fix type hinting in search_community_data use switch storage for private chats
1 parent aa6ea96 commit e980609

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
![GitHub stars](https://img.shields.io/github/stars/switchcollab/Switch-Bots-Python-Library)
66
![GitHub Forks](https://img.shields.io/github/forks/switchcollab/Switch-Bots-Python-Library)
7-
![Version](https://img.shields.io/badge/version-1.4.55-green.svg)
7+
![Version](https://img.shields.io/badge/version-1.4.62-green.svg)
88
![PyPI - Downloads](https://img.shields.io/pypi/dm/swibots)
99

1010
# SwiBots: Python Library for Switch App

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
setup(
1818
name="swibots",
19-
version="1.4.60",
20-
packages=find_packages(include=['swibots']),
19+
version="1.4.62",
20+
packages=find_packages(include=['swibots*']),
2121
long_description=long_description,
2222
long_description_content_type="text/markdown",
2323
url="https://github.com/switchcollab/Switch-Bots-Python-Library",

swibots/api/chat/controllers/heading_controller.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ async def delete_heading(self, community_id: str, heading_name: str):
6060
response = await self.client.post(f"/headings/delete-headings?{query}")
6161
return response.data
6262

63+
6364
async def edit_heading(
6465
self,
6566
community_id: str,
@@ -77,3 +78,17 @@ async def edit_heading(
7778
)
7879
response = await self.client.post(f"/headings/edit-headings?{query}")
7980
return response.data
81+
82+
async def rearrange_headings(self,
83+
community_id: str,
84+
heading_names: List[str],
85+
subheading: str = ''
86+
):
87+
body = {
88+
"communityId": community_id,
89+
"headingNames": heading_names,
90+
"subHeading": subheading
91+
}
92+
response = await self.client.post("/headings/rearrange-headings",
93+
data=body)
94+

swibots/api/chat/controllers/media_controller.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def __init__(self, client: "ChatClient") -> None:
195195
self.client = client
196196
self.api_url = "https://storage.switch.click"
197197

198-
self._min_file_size = 150 * 1024 * 1024
198+
self._min_file_size = 200 * 1024 * 1024
199199

200200
async def get_upload_url(self):
201201
async with AsyncClient(timeout=None) as client:
@@ -291,7 +291,7 @@ async def upload_media(
291291
callback: UploadProgressCallback = None,
292292
callback_args: Optional[tuple] = None,
293293
auto_thumb: Optional[bool] = True,
294-
part_size: int = int(os.getenv("UPLOAD_PART_SIZE", 100 * 1024 * 1024)),
294+
part_size: int = int(os.getenv("UPLOAD_PART_SIZE", 200 * 1024 * 1024)),
295295
task_count: int = int(os.getenv("UPLOAD_TASKS", 0)),
296296
for_document: bool = False,
297297
premium: bool = False,

swibots/api/chat/controllers/message_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def send_media(
183183
async def _upload_media(media):
184184
if document:
185185
force_storage_method = kwargs.get("secondary_upload", False)
186-
private_community = None
186+
private_community = bool(user_id)
187187
if community_id:
188188
community = await self.client.app.get_community(community_id)
189189
private_community = not community.is_public
@@ -782,8 +782,8 @@ async def search_community_data(
782782
query: str,
783783
community_id: str,
784784
filter: Literal[
785-
"MESSAGES", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
786-
] = "MESSAGES",
785+
"MESSAGE", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
786+
] = "MESSAGE",
787787
limit: int = 10,
788788
page: int = 0,
789789
) -> Union[List[Message], List[Group], List[Channel], List[SearchResultUser]]:
@@ -810,7 +810,7 @@ async def search_community_data(
810810
response = await self.client.get(
811811
"/v1/search/community-data?{}".format(urlencode(data))
812812
)
813-
if filter in ["MESSAGES", "MEDIA", "LINK"]:
813+
if filter in ["MESSAGE", "MEDIA", "LINK"]:
814814
return self.client.build_list(Message, response.data)
815815
elif filter == "GROUP":
816816
return self.client.build_list(Group, response.data)

swibots/api/chat/methods/get_community_media_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ async def search_community_data(
2929
query: str,
3030
community_id: str,
3131
filter: Literal[
32-
"MESSAGES", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
33-
] = "MESSAGES",
32+
"MESSAGE", "MEDIA", "LINK", "GROUP", "CHANNEL", "MEMBER"
33+
] = "MESSAGE",
3434
limit: int = 10,
3535
page: int = 0,
3636
) -> Union[List[Message], List[Group], List[Channel], List[SearchResultUser]]:

0 commit comments

Comments
 (0)