Skip to content

Commit

Permalink
Fixed broken handling of pending messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pylakey committed Jun 12, 2024
1 parent a45e2bb commit fb218de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions aiotdlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def _handle_pending_request(self, update: TDLibObject):
self._pending_requests.pop(request_id)
pending_request.set_update(update)

if isinstance(update.ID, UpdateMessageSendSucceeded):
if isinstance(update, UpdateMessageSendSucceeded):
pending_message_key = f"{update.message.chat_id}_{update.old_message_id}"
pending_message = self._pending_messages.pop(pending_message_key, None)

Expand Down Expand Up @@ -653,15 +653,14 @@ async def start(self) -> 'Client':
await self.execute(SetLogVerbosityLevel(new_verbosity_level=self.settings.tdlib_verbosity))
self.logger.info('Setting up proxy')
await self._setup_proxy()
self.logger.info('Setting up Options')
self.logger.info('Setting up options')
await self._setup_options()
self.logger.info("Initialize authorization process")
await self.authorize()
except asyncio.CancelledError:
await self._cleanup()
else:
self.logger.info('Authorization is completed...')
await self.send(GetCurrentState())

return self

Expand All @@ -680,6 +679,10 @@ async def stop(self):
async def get_my_id(self) -> int:
return await self.get_option_value('my_id')

async def load_current_state(self):
# All current state will be received via updates
await self.send(GetCurrentState())

async def get_option_value(self, name: str) -> typing.Union[str, int, bool, None]:
"""
Returns the value of an option by its name.
Expand Down

0 comments on commit fb218de

Please sign in to comment.