fix(cp): 错误的注册方法返回值
* 不是, 我用户 ID 呢
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user