fix(cp): 错误的注册方法返回值

* 不是, 我用户 ID 呢
This commit is contained in:
CrescentLeaf
2025-12-06 16:53:35 +08:00
parent b85b6833b6
commit 48bd884690

View File

@@ -180,18 +180,6 @@ export default class LingChairClient {
else else
throw new CallbackError(re) throw new CallbackError(re)
} }
async register(args: {
nickname: string,
username?: string,
password: string,
}) {
try {
await this.registerOrThrow(args)
return true
} catch (_) {
return false
}
}
getBaseHttpUrl() { getBaseHttpUrl() {
const url = new URL(this.server_url) const url = new URL(this.server_url)
return (({ return (({
@@ -204,6 +192,17 @@ export default class LingChairClient {
getUrlForFileByHash(file_hash?: string, defaultUrl?: string) { getUrlForFileByHash(file_hash?: string, defaultUrl?: string) {
return file_hash ? (this.getBaseHttpUrl() + '/uploaded_files/' + file_hash) : defaultUrl 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({ async registerOrThrow({
nickname, nickname,
username, username,
@@ -220,6 +219,7 @@ export default class LingChairClient {
}) })
if (re.code != 200) if (re.code != 200)
throw new CallbackError(re) throw new CallbackError(re)
return re.data!.user_id as string
} }
async uploadFile({ async uploadFile({
chatId, chatId,