Support a more obvious non-cached connection check
This commit is contained in:
parent
47b9623446
commit
82d64b9b37
@ -63,7 +63,7 @@ async def ping(evt: CommandEvent) -> None:
|
||||
if not await evt.sender.is_logged_in():
|
||||
await evt.reply("You are **logged out** of KakaoTalk.")
|
||||
else:
|
||||
is_connected = evt.sender.is_connected and await evt.sender.client.is_connected()
|
||||
is_connected = await evt.sender.is_connected_now()
|
||||
await evt.reply(
|
||||
"You are logged into KakaoTalk.\n\n"
|
||||
f"You are {'connected to' if is_connected else '**disconnected** from'} KakaoTalk chats."
|
||||
|
@ -177,6 +177,9 @@ class User(DBUser, BaseUser):
|
||||
self._is_connected = val
|
||||
self._connection_time = time.monotonic()
|
||||
|
||||
async def is_connected_now(self) -> bool:
|
||||
return self._client is not None and await self._client.is_connected()
|
||||
|
||||
@property
|
||||
def connection_time(self) -> float:
|
||||
return self._connection_time
|
||||
|
Loading…
Reference in New Issue
Block a user