Skip to content

Commit

Permalink
fix i64 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
piloking committed Oct 13, 2024
1 parent 82add25 commit 51da6c8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"thrift": "npm:thrift@^0.20.0",
"tweetnacl": "npm:tweetnacl@^1.0.3",
"jsdom": "npm:jsdom@25.0.0",
"node-types": "npm:@types/node@latest"
"node-types": "npm:@types/node@latest",
"node-int64":"npm:node-int64"
},
"tasks": {
"format": "deno run -A npm:@biomejs/biome format --write ./packages/**/*.ts",
Expand Down
9 changes: 5 additions & 4 deletions packages/linejs/client/clients/internal/talk-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// For Talk (talk, group(chat), etc)

import { default as Int64 } from "node-int64"
import type { NestedArray, ProtocolKey } from "../../libs/thrift/declares.ts";
import type * as LINETypes from "@evex/linejs-types";
import type { LooseType } from "../../entities/common.ts";
Expand Down Expand Up @@ -335,7 +335,7 @@ export class TalkClient extends ChannelClient {
public async getPreviousMessagesV2WithRequest(options: {
mid: string;
time: number;
id: number;
id: number|bigint;
count?: number;
withReadCount?: boolean;
receivedOnly?: boolean;
Expand All @@ -346,6 +346,7 @@ export class TalkClient extends ChannelClient {
receivedOnly: false,
...options,
};
const id64 = new Int64(id.toString(16))
return (
await this.direct_request(
[
Expand All @@ -359,15 +360,15 @@ export class TalkClient extends ChannelClient {
2,
[
[10, 1, time],
[10, 1, id],
[10, 2, id64],
],
],
[8, 3, count],
[2, 4, withReadCount],
[2, 5, receivedOnly],
],
],
[8, 3, 4],
[8, 3, 1],
],
"getPreviousMessagesV2WithRequest",
this.TalkService_PROTOCOL_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion packages/linejs/client/libs/thrift/declares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Protocols = {
export type ProtocolKey = keyof typeof Protocols;

export type NestedArray = Array<
NestedArray | boolean | number | string | null | undefined | Buffer
NestedArray | boolean | number | string | null | undefined | Buffer | LooseType
>;

export interface ParsedThrift {
Expand Down

0 comments on commit 51da6c8

Please sign in to comment.