Skip to content

Commit

Permalink
fixed get_dm_history
Browse files Browse the repository at this point in the history
  • Loading branch information
d60 committed Jun 4, 2024
1 parent f8bf908 commit ea2b3cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion twikit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
A Python library for interacting with the Twitter API.
"""

__version__ = '1.7.1'
__version__ = '1.7.2'

from ._captcha import Capsolver
from .bookmark import BookmarkFolder
Expand Down
4 changes: 4 additions & 0 deletions twikit/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3666,6 +3666,8 @@ def get_dm_history(
...
"""
response = self._get_dm_history(f'{user_id}-{self.user_id()}', max_id)
if 'entries' not in response['conversation_timeline']:
return Result([])

items = response['conversation_timeline']['entries']
messages = []
Expand Down Expand Up @@ -3780,6 +3782,8 @@ def get_group_dm_history(
...
"""
response = self._get_dm_history(group_id, max_id)
if 'entries' not in response['conversation_timeline']:
return Result([])

items = response['conversation_timeline']['entries']
messages = []
Expand Down
5 changes: 5 additions & 0 deletions twikit/twikit_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3701,6 +3701,9 @@ async def get_dm_history(
)

items = response['conversation_timeline']['entries']
if 'entries' not in response['conversation_timeline']:
return Result([])

messages = []
for item in items:
message_info = item['message']['message_data']
Expand Down Expand Up @@ -3814,6 +3817,8 @@ async def get_group_dm_history(
...
"""
response = await self._get_dm_history(group_id, max_id)
if 'entries' not in response['conversation_timeline']:
return Result([])

items = response['conversation_timeline']['entries']
messages = []
Expand Down

0 comments on commit ea2b3cf

Please sign in to comment.