diff --git a/client-protocol/LingChairClient.ts b/client-protocol/LingChairClient.ts index 5471f1e..349459c 100644 --- a/client-protocol/LingChairClient.ts +++ b/client-protocol/LingChairClient.ts @@ -180,18 +180,6 @@ export default class LingChairClient { else throw new CallbackError(re) } - async register(args: { - nickname: string, - username?: string, - password: string, - }) { - try { - await this.registerOrThrow(args) - return true - } catch (_) { - return false - } - } getBaseHttpUrl() { const url = new URL(this.server_url) return (({ @@ -204,6 +192,17 @@ export default class LingChairClient { getUrlForFileByHash(file_hash?: string, defaultUrl?: string) { return file_hash ? (this.getBaseHttpUrl() + '/uploaded_files/' + file_hash) : defaultUrl } + async register(args: { + nickname: string, + username?: string, + password: string, + }) { + try { + return await this.registerOrThrow(args) + } catch (_) { + return null + } + } async registerOrThrow({ nickname, username, @@ -220,6 +219,7 @@ export default class LingChairClient { }) if (re.code != 200) throw new CallbackError(re) + return re.data!.user_id as string } async uploadFile({ chatId,