Skip to content

Commit 6f8680e

Browse files
committed
2 parents f97de9a + 0a1dc5b commit 6f8680e

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

swibots/api/chat/controllers/message_controller.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import mimetypes
32
import os
43
import json
54
import logging
@@ -8,7 +7,6 @@
87
from io import BytesIO
98
from asyncio.tasks import Task
109
from swibots.types import MediaType
11-
from swibots.errors import CancelError
1210
from swibots.api.chat.models import (
1311
Message,
1412
GroupChatHistory,
@@ -368,15 +366,15 @@ async def delete_messages_from_user(
368366

369367
async def get_messages_between_users(
370368
self,
371-
recipient_id: int,
369+
other_user_id: int,
372370
user_id: int = None,
373371
page_limit: int = 100,
374372
page_offset: int = 0,
375373
) -> List[Message]:
376374
"""Get messages between two users
377375
378376
Parameters:
379-
recipient_id (``int``): The recipient id
377+
other_user_id (``int``): The other user id.
380378
user_id (``int``, *optional*): The user id. Defaults to the current user id.
381379
page_limit (``int``, *optional*): The page limit. Defaults to 100.
382380
page_offset (``int``, *optional*): The page offset. Defaults to 0.
@@ -389,17 +387,17 @@ async def get_messages_between_users(
389387
"""
390388
data = {
391389
"pageOffset": page_offset,
392-
"pageLimit": 0,
390+
"pageLimit": page_limit,
393391
}
394392

395393
if user_id is None:
396394
user_id = self.client.user.id
397395

398-
log.debug("Getting messages for user %s", recipient_id)
396+
log.debug("Getting messages for user %s", other_user_id)
399397
response = await self.client.get(
400-
f"{BASE_PATH}/{user_id}/{recipient_id}?{urlencode(data)}"
398+
f"{BASE_PATH}/{user_id}/{other_user_id}?{urlencode(data)}"
401399
)
402-
return self.client.build_list(Message, response.data["messages"])
400+
return self.client.build_list(Message, response.data)
403401

404402
async def forward_message(
405403
self,

swibots/api/chat/methods/get_messages_between_users.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
class GetMessagesBetweenUsers:
77
async def get_messages_between_users(
88
self: "swibots.ApiClient",
9-
user_id: int,
109
other_user_id: int,
10+
user_id: int = None,
1111
limit: int = 100,
1212
offset: int = 0,
1313
) -> List[Message]:
1414
"""Get messages between users
1515
1616
Parameters:
17-
user_id (``int``): The user id
18-
other_user_id (``int``): The other user id
17+
other_user_id (``int``): The other user id.
18+
user_id (``int``, *optional*): The user id. Defaults to the current user id.
1919
limit (``int``, *optional*): The maximum number of messages to retrieve. Defaults to 100.
2020
offset (``int``, *optional*): The offset. Defaults to 0.
2121
@@ -28,5 +28,5 @@ async def get_messages_between_users(
2828
This function does the same as :meth:`~switch.api.chat.controllers.MessageController.get_messages_between_users`.
2929
"""
3030
return await self.chat_service.messages.get_messages_between_users(
31-
user_id, other_user_id, limit, offset
31+
other_user_id, user_id, limit, offset
3232
)

0 commit comments

Comments
 (0)