diff --git a/packages/linejs/client/clients/base-client.ts b/packages/linejs/client/clients/base-client.ts index 2a6d640..adf3767 100644 --- a/packages/linejs/client/clients/base-client.ts +++ b/packages/linejs/client/clients/base-client.ts @@ -610,15 +610,15 @@ export class BaseClient extends TypedEventEmitter { const chat = message.toType === LINETypes.MIDType._USER ? () => { - return this.getContact({ mid: sendIn }); - } + return this.getContact({ mid: sendIn }); + } : undefined; const group = message.toType !== LINETypes.MIDType._USER ? async () => { - return (await this.getChats({ mids: [sendIn] })).chats[0]; - } + return (await this.getChats({ mids: [sendIn] })).chats[0]; + } : (undefined as LooseType); const getContact = () => { @@ -1201,7 +1201,7 @@ export class BaseClient extends TypedEventEmitter { } return authToken; } - throw new InternalError("TimeoutError", "checkQrCodeVerified timed out") + throw new InternalError("TimeoutError", "checkQrCodeVerified timed out"); } public async requestSQR2(): Promise { @@ -1230,7 +1230,7 @@ export class BaseClient extends TypedEventEmitter { this.storage.set("expire", tokenInfo[3] + tokenInfo[6]); return tokenInfo[1]; } - throw new InternalError("TimeoutError", "checkQrCodeVerified timed out") + throw new InternalError("TimeoutError", "checkQrCodeVerified timed out"); } /** @@ -1257,7 +1257,7 @@ export class BaseClient extends TypedEventEmitter { /** * @description Will override. */ - public decodeE2EEKeyV1(_data: LooseType, _secret: Buffer): LooseType { } + public decodeE2EEKeyV1(_data: LooseType, _secret: Buffer): LooseType {} /** * @description Will override. @@ -1478,7 +1478,7 @@ export class BaseClient extends TypedEventEmitter { * @param {object} [headers={}] - The headers of the request. * @param {number} [timeOutMs=this.timeOutMs] - The timeout milliseconds of the request. * @returns {Promise} The response. - * + * * --- * Use for functions that take one thrift struct argument * ``` @@ -1520,7 +1520,7 @@ export class BaseClient extends TypedEventEmitter { * @param {object} [headers={}] - The headers of the request. * @param {number} [timeOutMs=this.timeOutMs] - The timeout milliseconds of the request. * @returns {Promise} The response. - * + * * --- * Use for functions that take two or more arguments * ``` @@ -1711,12 +1711,13 @@ export class BaseClient extends TypedEventEmitter { return res; } catch (error) { if (error instanceof InternalError) { - throw error + throw error; } else { throw new InternalError( "Request internal failed", - `${methodName}(${path}) -> ` + JSON.stringify({ ...(error as object) }), - { error } + `${methodName}(${path}) -> ` + + JSON.stringify({ ...(error as object) }), + { error }, ); } } @@ -2038,7 +2039,9 @@ export class BaseClient extends TypedEventEmitter { private reqseqs: Record; public getReqseq(name: string = "talk"): number { - if (!this.reqseqs[name]) { this.reqseqs[name] = 0 }; + if (!this.reqseqs[name]) { + this.reqseqs[name] = 0; + } const seq = this.reqseqs[name]; this.reqseqs[name]++; this.storage.set("reqseq", JSON.stringify(this.reqseqs)); diff --git a/packages/linejs/client/clients/internal/square-client.ts b/packages/linejs/client/clients/internal/square-client.ts index 7da89f0..0ea2d7c 100644 --- a/packages/linejs/client/clients/internal/square-client.ts +++ b/packages/linejs/client/clients/internal/square-client.ts @@ -315,7 +315,7 @@ export class SquareClient extends LiffClient { continuationToken?: string; subscriptionId?: number; squareThreadMid?: string; - direction?: number + direction?: number; }): Promise { const { squareChatMid, @@ -326,10 +326,11 @@ export class SquareClient extends LiffClient { squareThreadMid, direction, } = { limit: 100, direction: 1, ...options }; - let _syncToken = syncToken, _direction = direction; + let _syncToken = syncToken, + _direction = direction; if (continuationToken) { - _syncToken = continuationToken - _direction = 2 + _syncToken = continuationToken; + _direction = 2; } return this.request( [ diff --git a/packages/linejs/client/clients/internal/talk-client.ts b/packages/linejs/client/clients/internal/talk-client.ts index e79be7d..86e12b3 100644 --- a/packages/linejs/client/clients/internal/talk-client.ts +++ b/packages/linejs/client/clients/internal/talk-client.ts @@ -797,20 +797,20 @@ export class TalkClient extends ChannelClient { chatSet.picturePath ? [11, 7, chatSet.picturePath] : null, chatSet.extra?.groupExtra ? [ - 12, - 8, - [ + 12, + 8, [ - 12, - 1, [ - [2, 2, chatSet.extra.groupExtra.preventedJoinByTicket], - [2, 6, chatSet.extra.groupExtra.addFriendDisabled], - [2, 7, chatSet.extra.groupExtra.ticketDisabled], + 12, + 1, + [ + [2, 2, chatSet.extra.groupExtra.preventedJoinByTicket], + [2, 6, chatSet.extra.groupExtra.addFriendDisabled], + [2, 7, chatSet.extra.groupExtra.ticketDisabled], + ], ], ], - ], - ] + ] : null, ], ], diff --git a/packages/linejs/client/entities/square-class.ts b/packages/linejs/client/entities/square-class.ts index 5f56281..3ec57df 100644 --- a/packages/linejs/client/entities/square-class.ts +++ b/packages/linejs/client/entities/square-class.ts @@ -19,7 +19,7 @@ type SquareEvents = { "update:note": (note: LINETypes.NoteStatus) => void; "update:authority": (authority: LINETypes.SquareAuthority) => void; "update:square": (square: LINETypes.Square) => void; - "update": (square: Square) => void; + update: (square: Square) => void; shutdown: (square: LINETypes.Square) => void; }; @@ -254,7 +254,7 @@ export class SquareChat extends TypedEventEmitter { if ( event.payload.notifiedUpdateSquareChatStatus && event.payload.notifiedUpdateSquareChatStatus.squareChatMid === - this.mid + this.mid ) { this.status = event.payload.notifiedUpdateSquareChatStatus.statusWithoutMessage; @@ -282,7 +282,7 @@ export class SquareChat extends TypedEventEmitter { } }); if (polling) { - this.on("event", (event) => { }); + this.on("event", (event) => {}); } } } @@ -317,12 +317,12 @@ export class SquareChat extends TypedEventEmitter { options: | string | { - text?: string; - contentType?: number; - contentMetadata?: LooseType; - relatedMessageId?: string; - location?: LINETypes.Location; - }, + text?: string; + contentType?: number; + contentMetadata?: LooseType; + relatedMessageId?: string; + location?: LINETypes.Location; + }, ): Promise { if (typeof options === "string") { return this.send({ text: options }); diff --git a/packages/linejs/client/entities/talk-class.ts b/packages/linejs/client/entities/talk-class.ts index eecb0ab..12afeee 100644 --- a/packages/linejs/client/entities/talk-class.ts +++ b/packages/linejs/client/entities/talk-class.ts @@ -36,7 +36,7 @@ type UserEvents = { /** * @description Gets mid's type - * + * * USER(0),\ * ROOM(1),\ * GROUP(2),\ @@ -71,7 +71,7 @@ export class Note { constructor( public mid: string, private client: Client, - ) { } + ) {} public createPost(options: { text?: string; @@ -235,14 +235,14 @@ export class User extends TypedEventEmitter { options: | string | { - text?: string; - contentType?: number; - contentMetadata?: LooseType; - relatedMessageId?: string; - location?: LINETypes.Location; - chunk?: string[] | Buffer[]; - e2ee?: boolean; - }, + text?: string; + contentType?: number; + contentMetadata?: LooseType; + relatedMessageId?: string; + location?: LINETypes.Location; + chunk?: string[] | Buffer[]; + e2ee?: boolean; + }, ): Promise { if (typeof options === "string") { return this.send({ text: options }); @@ -256,9 +256,7 @@ export class User extends TypedEventEmitter { /** * @description Kickout from group. */ - public kick( - chatMid: string, - ): Promise { + public kick(chatMid: string): Promise { return this.client.deleteOtherFromChat({ to: chatMid, mid: this.mid }); } @@ -391,14 +389,14 @@ export class Group extends TypedEventEmitter { options: | string | { - text?: string; - contentType?: number; - contentMetadata?: LooseType; - relatedMessageId?: string; - location?: LINETypes.Location; - chunk?: string[] | Buffer[]; - e2ee?: boolean; - }, + text?: string; + contentType?: number; + contentMetadata?: LooseType; + relatedMessageId?: string; + location?: LINETypes.Location; + chunk?: string[] | Buffer[]; + e2ee?: boolean; + }, ): Promise { if (typeof options === "string") { return this.send({ text: options }); @@ -955,5 +953,3 @@ export class SendChatRemoved { this.chatType = getMidType(op.param[1]); } } - -