Compare commits

..

3 Commits

Author SHA1 Message Date
e35082bbea Improve "whoami", especially for users with no KakaoTalk ID
Also show whether the KakaoTalk ID is searchable or not
2022-05-02 02:52:55 -04:00
f1e08caee0 Fix token renewal for already logged-in users 2022-05-02 02:50:49 -04:00
d0dc921fd4 Add missing return on "whoami" error 2022-05-02 02:23:15 -04:00
2 changed files with 5 additions and 3 deletions

View File

@ -65,13 +65,15 @@ async def whoami(evt: CommandEvent) -> None:
own_info = None own_info = None
except CommandException as e: except CommandException as e:
await evt.reply(f"Error from KakaoTalk: {e}") await evt.reply(f"Error from KakaoTalk: {e}")
return
if own_info: if own_info:
uuid = f"`{own_info.more.uuid}` ({'' if own_info.more.uuidSearchable else 'not '}searchable)" if own_info.more.uuid else "_none_"
await evt.reply( await evt.reply(
f"You're logged in as `{own_info.more.uuid}` (nickname: {own_info.more.nickName}, user ID: {evt.sender.ktid})." f"You're logged in as **{own_info.more.nickName}** (KakaoTalk ID: {uuid}, internal ID: `{evt.sender.ktid}`)"
) )
else: else:
await evt.reply( await evt.reply(
f"You're logged in, but the bridge is unable to retrieve your profile information (user ID: {evt.sender.ktid})." f"You're logged in, but the bridge is unable to retrieve your profile information (internal ID: {evt.sender.ktid})"
) )

View File

@ -598,7 +598,7 @@ export default class PeerClient {
const oAuthClient = await OAuthApiClient.create() const oAuthClient = await OAuthApiClient.create()
const res = await oAuthClient.renew(req.oauth_credential) const res = await oAuthClient.renew(req.oauth_credential)
if (res.success && userClient) { if (res.success && userClient) {
await userClient.setCredential(res.result) await userClient.setCredential(res.result.credential)
} }
return res return res
} }