@meet-im/meet-bot-jssdk 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +16 -62
- package/dist/index.d.cts +3 -25
- package/dist/index.d.ts +3 -25
- package/dist/index.js +17 -62
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -121,9 +121,9 @@ var HTTP = {
|
|
|
121
121
|
UPLOAD_TIMEOUT: 3600 * 1e3
|
|
122
122
|
};
|
|
123
123
|
var API = {
|
|
124
|
-
/**
|
|
125
|
-
DEFAULT_TIMEOUT:
|
|
126
|
-
/**
|
|
124
|
+
/** getUpdatesV2 默认超时时间(秒),默认 28(long polling) */
|
|
125
|
+
DEFAULT_TIMEOUT: 28,
|
|
126
|
+
/** getUpdatesV2 默认拉取条数,默认 100 条 */
|
|
127
127
|
DEFAULT_LIMIT: 100
|
|
128
128
|
};
|
|
129
129
|
var UPLOAD = {
|
|
@@ -648,22 +648,6 @@ async function getUsers(params) {
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
// src/api/index.ts
|
|
651
|
-
async function getUpdates(params) {
|
|
652
|
-
const { token, baseUrl, userAgent, timeout = API.DEFAULT_TIMEOUT, offset, limit = API.DEFAULT_LIMIT } = params;
|
|
653
|
-
return request({
|
|
654
|
-
token,
|
|
655
|
-
baseUrl,
|
|
656
|
-
userAgent,
|
|
657
|
-
method: "POST",
|
|
658
|
-
path: "getUpdates",
|
|
659
|
-
body: {
|
|
660
|
-
timeout,
|
|
661
|
-
offset,
|
|
662
|
-
limit
|
|
663
|
-
},
|
|
664
|
-
timeout: (timeout || 0) * 1e3 + HTTP.POLLING_TIMEOUT_BUFFER
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
651
|
async function getUpdatesV2(params) {
|
|
668
652
|
const { token, baseUrl, userAgent, timeout = API.DEFAULT_TIMEOUT, limit = API.DEFAULT_LIMIT } = params;
|
|
669
653
|
return request({
|
|
@@ -840,7 +824,6 @@ var MeetBot = class {
|
|
|
840
824
|
baseUrl;
|
|
841
825
|
pollingLimit;
|
|
842
826
|
longPollingTimeout;
|
|
843
|
-
useV2;
|
|
844
827
|
userAgent;
|
|
845
828
|
eventHandlers = /* @__PURE__ */ new Map();
|
|
846
829
|
polling = false;
|
|
@@ -861,7 +844,6 @@ var MeetBot = class {
|
|
|
861
844
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
862
845
|
this.pollingLimit = config.pollingLimit ?? POLLING.DEFAULT_LIMIT;
|
|
863
846
|
this.longPollingTimeout = config.longPollingTimeout ?? POLLING.DEFAULT_TIMEOUT;
|
|
864
|
-
this.useV2 = config.useV2 ?? false;
|
|
865
847
|
this.userAgent = config.userAgent;
|
|
866
848
|
this.userCache = new UserCache(config.userCacheOptions);
|
|
867
849
|
logger.setLevel(config.logLevel ?? "silent");
|
|
@@ -903,7 +885,7 @@ var MeetBot = class {
|
|
|
903
885
|
this.abortController = new AbortController();
|
|
904
886
|
const limit = options?.limit ?? this.pollingLimit;
|
|
905
887
|
const timeout = options?.timeout ?? this.longPollingTimeout;
|
|
906
|
-
logger.info(`\u5F00\u59CB\u957F\u8F6E\u8BE2\u6D88\u606F... (\u6761\u6570: ${limit}, \u8D85\u65F6: ${timeout}s
|
|
888
|
+
logger.info(`\u5F00\u59CB\u957F\u8F6E\u8BE2\u6D88\u606F... (\u6761\u6570: ${limit}, \u8D85\u65F6: ${timeout}s)`);
|
|
907
889
|
this.emit("polling_start", void 0);
|
|
908
890
|
const retryDelay = options?.retryDelay ?? POLLING.DEFAULT_RETRY_DELAY;
|
|
909
891
|
const maxRetries = options?.maxRetries ?? POLLING.DEFAULT_MAX_RETRIES;
|
|
@@ -911,37 +893,18 @@ var MeetBot = class {
|
|
|
911
893
|
let retryCount = 0;
|
|
912
894
|
while (this.polling) {
|
|
913
895
|
try {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
onOffsetUpdate?.(this.offset);
|
|
927
|
-
}
|
|
928
|
-
} else {
|
|
929
|
-
const updates = await getUpdates({
|
|
930
|
-
token: this.token,
|
|
931
|
-
baseUrl: this.baseUrl,
|
|
932
|
-
userAgent: this.userAgent,
|
|
933
|
-
timeout,
|
|
934
|
-
offset: this.offset,
|
|
935
|
-
limit
|
|
936
|
-
});
|
|
937
|
-
retryCount = 0;
|
|
938
|
-
for (const update of updates) {
|
|
939
|
-
if (update.message) {
|
|
940
|
-
this.emit("message", { message: update.message, quoteMsgMap: {} });
|
|
941
|
-
this.offset = (update.message.seqId || 0) + 1;
|
|
942
|
-
onOffsetUpdate?.(this.offset);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
896
|
+
const result = await getUpdatesV2({
|
|
897
|
+
token: this.token,
|
|
898
|
+
baseUrl: this.baseUrl,
|
|
899
|
+
userAgent: this.userAgent,
|
|
900
|
+
timeout,
|
|
901
|
+
limit
|
|
902
|
+
});
|
|
903
|
+
retryCount = 0;
|
|
904
|
+
for (const msgUpdate of result.msgs) {
|
|
905
|
+
this.emit("message", { message: msgUpdate.message, quoteMsgMap: result.quoteMsgMap });
|
|
906
|
+
this.offset = (msgUpdate.message.seqId || 0) + 1;
|
|
907
|
+
onOffsetUpdate?.(this.offset);
|
|
945
908
|
}
|
|
946
909
|
await this.sleep(POLLING.SUCCESS_DELAY);
|
|
947
910
|
} catch (error) {
|
|
@@ -965,14 +928,6 @@ var MeetBot = class {
|
|
|
965
928
|
}
|
|
966
929
|
this.emit("polling_stop", void 0);
|
|
967
930
|
}
|
|
968
|
-
async getUpdates(options) {
|
|
969
|
-
return getUpdates({
|
|
970
|
-
token: this.token,
|
|
971
|
-
baseUrl: this.baseUrl,
|
|
972
|
-
userAgent: this.userAgent,
|
|
973
|
-
...options
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
931
|
async getUpdatesV2(options) {
|
|
977
932
|
return getUpdatesV2({
|
|
978
933
|
token: this.token,
|
|
@@ -1143,7 +1098,6 @@ exports.getChunkNum = getChunkNum;
|
|
|
1143
1098
|
exports.getConvID = getConvID;
|
|
1144
1099
|
exports.getMultiPartUploadURL = getMultiPartUploadURL;
|
|
1145
1100
|
exports.getQuoteMsgKey = getQuoteMsgKey;
|
|
1146
|
-
exports.getUpdates = getUpdates;
|
|
1147
1101
|
exports.getUpdatesV2 = getUpdatesV2;
|
|
1148
1102
|
exports.getUploadURL = getUploadURL;
|
|
1149
1103
|
exports.getUsers = getUsers;
|
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ declare const HTTP: {
|
|
|
13
13
|
readonly UPLOAD_TIMEOUT: number;
|
|
14
14
|
};
|
|
15
15
|
declare const API: {
|
|
16
|
-
readonly DEFAULT_TIMEOUT:
|
|
16
|
+
readonly DEFAULT_TIMEOUT: 28;
|
|
17
17
|
readonly DEFAULT_LIMIT: 100;
|
|
18
18
|
};
|
|
19
19
|
declare const UPLOAD: {
|
|
@@ -74,6 +74,7 @@ interface ExtraInfo {
|
|
|
74
74
|
}
|
|
75
75
|
interface MsgContent {
|
|
76
76
|
content: string;
|
|
77
|
+
dmTopicID?: string;
|
|
77
78
|
seqId?: number;
|
|
78
79
|
timestamp?: number;
|
|
79
80
|
fromUid?: number;
|
|
@@ -149,16 +150,8 @@ interface MeetBotConfig {
|
|
|
149
150
|
pollingLimit?: number;
|
|
150
151
|
longPollingTimeout?: number;
|
|
151
152
|
logLevel?: LogLevel;
|
|
152
|
-
useV2?: boolean;
|
|
153
153
|
userAgent?: string;
|
|
154
154
|
}
|
|
155
|
-
interface GetUpdatesOptions {
|
|
156
|
-
token: string;
|
|
157
|
-
baseUrl?: string;
|
|
158
|
-
timeout?: number;
|
|
159
|
-
offset?: number;
|
|
160
|
-
limit?: number;
|
|
161
|
-
}
|
|
162
155
|
interface SendMessageOptions {
|
|
163
156
|
token: string;
|
|
164
157
|
baseUrl?: string;
|
|
@@ -369,7 +362,6 @@ declare class MeetBot {
|
|
|
369
362
|
private readonly baseUrl;
|
|
370
363
|
private readonly pollingLimit;
|
|
371
364
|
private readonly longPollingTimeout;
|
|
372
|
-
private readonly useV2;
|
|
373
365
|
private readonly userAgent?;
|
|
374
366
|
private readonly eventHandlers;
|
|
375
367
|
private polling;
|
|
@@ -385,11 +377,6 @@ declare class MeetBot {
|
|
|
385
377
|
isPolling(): boolean;
|
|
386
378
|
startPolling(options?: PollingOptions): Promise<void>;
|
|
387
379
|
stopPolling(): void;
|
|
388
|
-
getUpdates(options?: {
|
|
389
|
-
timeout?: number;
|
|
390
|
-
offset?: number;
|
|
391
|
-
limit?: number;
|
|
392
|
-
}): Promise<BotUpdate[]>;
|
|
393
380
|
getUpdatesV2(options?: {
|
|
394
381
|
timeout?: number;
|
|
395
382
|
limit?: number;
|
|
@@ -446,15 +433,6 @@ declare function getUsers(params: {
|
|
|
446
433
|
userAgent?: string;
|
|
447
434
|
}): Promise<MeetUser[]>;
|
|
448
435
|
|
|
449
|
-
interface GetUpdatesParams {
|
|
450
|
-
token: string;
|
|
451
|
-
baseUrl?: string;
|
|
452
|
-
userAgent?: string;
|
|
453
|
-
timeout?: number;
|
|
454
|
-
offset?: number;
|
|
455
|
-
limit?: number;
|
|
456
|
-
}
|
|
457
|
-
declare function getUpdates(params: GetUpdatesParams): Promise<BotUpdate[]>;
|
|
458
436
|
interface GetUpdatesV2Params {
|
|
459
437
|
token: string;
|
|
460
438
|
baseUrl?: string;
|
|
@@ -473,4 +451,4 @@ interface SendMessageParams {
|
|
|
473
451
|
declare function sendMessage(params: SendMessageParams): Promise<SendMessageResult>;
|
|
474
452
|
declare function sendUserTyping(params: SendUserTypingParams): Promise<void>;
|
|
475
453
|
|
|
476
|
-
export { API, type AccessURLResult, ApiError, type ApiErrorResponse, type ApiResponse, type AttachmentInfo, type BotChat, type BotFile, type BotMsg, type BotMsgUpdate, type BotUpdate, type BotUser, CHUNK_RULES, type ChatType, type CompleteMultipartUploadParams, type CompleteMultipartUploadResult, DEFAULT_BASE_URL, type ErrorCode, type ExtraInfo, type GetAccessURLBySessionParams, type GetAccessURLParams, type GetMultiPartUploadURLParams, type
|
|
454
|
+
export { API, type AccessURLResult, ApiError, type ApiErrorResponse, type ApiResponse, type AttachmentInfo, type BotChat, type BotFile, type BotMsg, type BotMsgUpdate, type BotUpdate, type BotUser, CHUNK_RULES, type ChatType, type CompleteMultipartUploadParams, type CompleteMultipartUploadResult, DEFAULT_BASE_URL, type ErrorCode, type ExtraInfo, type GetAccessURLBySessionParams, type GetAccessURLParams, type GetMultiPartUploadURLParams, type GetUpdatesV2Result, type GetUploadURLParams, HTTP, type LogLevel, MeetBot, type MeetBotConfig, MeetBotError, type MeetUser, type MsgContent, type MsgType, type MultiPartUploadURLResult, NetworkError, POLLING, type PollingOptions, type QuoteMsgMap, type ReceivedAttachmentInfo, SESSION_TYPE, type SendMediaOptions, type SendMessageOptions, type SendMessageResult, type SendUserTypingParams, type SessionInfo, type SessionType, TYPING_ACTION, TimeoutError, type TypingAction, UPLOAD, type UploadFileOptions, type UploadFileResult, type UploadPart, type UploadProgress, type UploadURLResult, UserCache, type UserCacheOptions, ValidationError, completeMultipartUpload, computeMD5, getAccessURL, getChunkNum, getConvID, getMultiPartUploadURL, getQuoteMsgKey, getUpdatesV2, getUploadURL, getUsers, sendMediaMessage, sendMessage, sendUserTyping, uploadFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare const HTTP: {
|
|
|
13
13
|
readonly UPLOAD_TIMEOUT: number;
|
|
14
14
|
};
|
|
15
15
|
declare const API: {
|
|
16
|
-
readonly DEFAULT_TIMEOUT:
|
|
16
|
+
readonly DEFAULT_TIMEOUT: 28;
|
|
17
17
|
readonly DEFAULT_LIMIT: 100;
|
|
18
18
|
};
|
|
19
19
|
declare const UPLOAD: {
|
|
@@ -74,6 +74,7 @@ interface ExtraInfo {
|
|
|
74
74
|
}
|
|
75
75
|
interface MsgContent {
|
|
76
76
|
content: string;
|
|
77
|
+
dmTopicID?: string;
|
|
77
78
|
seqId?: number;
|
|
78
79
|
timestamp?: number;
|
|
79
80
|
fromUid?: number;
|
|
@@ -149,16 +150,8 @@ interface MeetBotConfig {
|
|
|
149
150
|
pollingLimit?: number;
|
|
150
151
|
longPollingTimeout?: number;
|
|
151
152
|
logLevel?: LogLevel;
|
|
152
|
-
useV2?: boolean;
|
|
153
153
|
userAgent?: string;
|
|
154
154
|
}
|
|
155
|
-
interface GetUpdatesOptions {
|
|
156
|
-
token: string;
|
|
157
|
-
baseUrl?: string;
|
|
158
|
-
timeout?: number;
|
|
159
|
-
offset?: number;
|
|
160
|
-
limit?: number;
|
|
161
|
-
}
|
|
162
155
|
interface SendMessageOptions {
|
|
163
156
|
token: string;
|
|
164
157
|
baseUrl?: string;
|
|
@@ -369,7 +362,6 @@ declare class MeetBot {
|
|
|
369
362
|
private readonly baseUrl;
|
|
370
363
|
private readonly pollingLimit;
|
|
371
364
|
private readonly longPollingTimeout;
|
|
372
|
-
private readonly useV2;
|
|
373
365
|
private readonly userAgent?;
|
|
374
366
|
private readonly eventHandlers;
|
|
375
367
|
private polling;
|
|
@@ -385,11 +377,6 @@ declare class MeetBot {
|
|
|
385
377
|
isPolling(): boolean;
|
|
386
378
|
startPolling(options?: PollingOptions): Promise<void>;
|
|
387
379
|
stopPolling(): void;
|
|
388
|
-
getUpdates(options?: {
|
|
389
|
-
timeout?: number;
|
|
390
|
-
offset?: number;
|
|
391
|
-
limit?: number;
|
|
392
|
-
}): Promise<BotUpdate[]>;
|
|
393
380
|
getUpdatesV2(options?: {
|
|
394
381
|
timeout?: number;
|
|
395
382
|
limit?: number;
|
|
@@ -446,15 +433,6 @@ declare function getUsers(params: {
|
|
|
446
433
|
userAgent?: string;
|
|
447
434
|
}): Promise<MeetUser[]>;
|
|
448
435
|
|
|
449
|
-
interface GetUpdatesParams {
|
|
450
|
-
token: string;
|
|
451
|
-
baseUrl?: string;
|
|
452
|
-
userAgent?: string;
|
|
453
|
-
timeout?: number;
|
|
454
|
-
offset?: number;
|
|
455
|
-
limit?: number;
|
|
456
|
-
}
|
|
457
|
-
declare function getUpdates(params: GetUpdatesParams): Promise<BotUpdate[]>;
|
|
458
436
|
interface GetUpdatesV2Params {
|
|
459
437
|
token: string;
|
|
460
438
|
baseUrl?: string;
|
|
@@ -473,4 +451,4 @@ interface SendMessageParams {
|
|
|
473
451
|
declare function sendMessage(params: SendMessageParams): Promise<SendMessageResult>;
|
|
474
452
|
declare function sendUserTyping(params: SendUserTypingParams): Promise<void>;
|
|
475
453
|
|
|
476
|
-
export { API, type AccessURLResult, ApiError, type ApiErrorResponse, type ApiResponse, type AttachmentInfo, type BotChat, type BotFile, type BotMsg, type BotMsgUpdate, type BotUpdate, type BotUser, CHUNK_RULES, type ChatType, type CompleteMultipartUploadParams, type CompleteMultipartUploadResult, DEFAULT_BASE_URL, type ErrorCode, type ExtraInfo, type GetAccessURLBySessionParams, type GetAccessURLParams, type GetMultiPartUploadURLParams, type
|
|
454
|
+
export { API, type AccessURLResult, ApiError, type ApiErrorResponse, type ApiResponse, type AttachmentInfo, type BotChat, type BotFile, type BotMsg, type BotMsgUpdate, type BotUpdate, type BotUser, CHUNK_RULES, type ChatType, type CompleteMultipartUploadParams, type CompleteMultipartUploadResult, DEFAULT_BASE_URL, type ErrorCode, type ExtraInfo, type GetAccessURLBySessionParams, type GetAccessURLParams, type GetMultiPartUploadURLParams, type GetUpdatesV2Result, type GetUploadURLParams, HTTP, type LogLevel, MeetBot, type MeetBotConfig, MeetBotError, type MeetUser, type MsgContent, type MsgType, type MultiPartUploadURLResult, NetworkError, POLLING, type PollingOptions, type QuoteMsgMap, type ReceivedAttachmentInfo, SESSION_TYPE, type SendMediaOptions, type SendMessageOptions, type SendMessageResult, type SendUserTypingParams, type SessionInfo, type SessionType, TYPING_ACTION, TimeoutError, type TypingAction, UPLOAD, type UploadFileOptions, type UploadFileResult, type UploadPart, type UploadProgress, type UploadURLResult, UserCache, type UserCacheOptions, ValidationError, completeMultipartUpload, computeMD5, getAccessURL, getChunkNum, getConvID, getMultiPartUploadURL, getQuoteMsgKey, getUpdatesV2, getUploadURL, getUsers, sendMediaMessage, sendMessage, sendUserTyping, uploadFile };
|
package/dist/index.js
CHANGED
|
@@ -115,9 +115,9 @@ var HTTP = {
|
|
|
115
115
|
UPLOAD_TIMEOUT: 3600 * 1e3
|
|
116
116
|
};
|
|
117
117
|
var API = {
|
|
118
|
-
/**
|
|
119
|
-
DEFAULT_TIMEOUT:
|
|
120
|
-
/**
|
|
118
|
+
/** getUpdatesV2 默认超时时间(秒),默认 28(long polling) */
|
|
119
|
+
DEFAULT_TIMEOUT: 28,
|
|
120
|
+
/** getUpdatesV2 默认拉取条数,默认 100 条 */
|
|
121
121
|
DEFAULT_LIMIT: 100
|
|
122
122
|
};
|
|
123
123
|
var UPLOAD = {
|
|
@@ -642,22 +642,6 @@ async function getUsers(params) {
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
// src/api/index.ts
|
|
645
|
-
async function getUpdates(params) {
|
|
646
|
-
const { token, baseUrl, userAgent, timeout = API.DEFAULT_TIMEOUT, offset, limit = API.DEFAULT_LIMIT } = params;
|
|
647
|
-
return request({
|
|
648
|
-
token,
|
|
649
|
-
baseUrl,
|
|
650
|
-
userAgent,
|
|
651
|
-
method: "POST",
|
|
652
|
-
path: "getUpdates",
|
|
653
|
-
body: {
|
|
654
|
-
timeout,
|
|
655
|
-
offset,
|
|
656
|
-
limit
|
|
657
|
-
},
|
|
658
|
-
timeout: (timeout || 0) * 1e3 + HTTP.POLLING_TIMEOUT_BUFFER
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
645
|
async function getUpdatesV2(params) {
|
|
662
646
|
const { token, baseUrl, userAgent, timeout = API.DEFAULT_TIMEOUT, limit = API.DEFAULT_LIMIT } = params;
|
|
663
647
|
return request({
|
|
@@ -834,7 +818,6 @@ var MeetBot = class {
|
|
|
834
818
|
baseUrl;
|
|
835
819
|
pollingLimit;
|
|
836
820
|
longPollingTimeout;
|
|
837
|
-
useV2;
|
|
838
821
|
userAgent;
|
|
839
822
|
eventHandlers = /* @__PURE__ */ new Map();
|
|
840
823
|
polling = false;
|
|
@@ -855,7 +838,6 @@ var MeetBot = class {
|
|
|
855
838
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
856
839
|
this.pollingLimit = config.pollingLimit ?? POLLING.DEFAULT_LIMIT;
|
|
857
840
|
this.longPollingTimeout = config.longPollingTimeout ?? POLLING.DEFAULT_TIMEOUT;
|
|
858
|
-
this.useV2 = config.useV2 ?? false;
|
|
859
841
|
this.userAgent = config.userAgent;
|
|
860
842
|
this.userCache = new UserCache(config.userCacheOptions);
|
|
861
843
|
logger.setLevel(config.logLevel ?? "silent");
|
|
@@ -897,7 +879,7 @@ var MeetBot = class {
|
|
|
897
879
|
this.abortController = new AbortController();
|
|
898
880
|
const limit = options?.limit ?? this.pollingLimit;
|
|
899
881
|
const timeout = options?.timeout ?? this.longPollingTimeout;
|
|
900
|
-
logger.info(`\u5F00\u59CB\u957F\u8F6E\u8BE2\u6D88\u606F... (\u6761\u6570: ${limit}, \u8D85\u65F6: ${timeout}s
|
|
882
|
+
logger.info(`\u5F00\u59CB\u957F\u8F6E\u8BE2\u6D88\u606F... (\u6761\u6570: ${limit}, \u8D85\u65F6: ${timeout}s)`);
|
|
901
883
|
this.emit("polling_start", void 0);
|
|
902
884
|
const retryDelay = options?.retryDelay ?? POLLING.DEFAULT_RETRY_DELAY;
|
|
903
885
|
const maxRetries = options?.maxRetries ?? POLLING.DEFAULT_MAX_RETRIES;
|
|
@@ -905,37 +887,18 @@ var MeetBot = class {
|
|
|
905
887
|
let retryCount = 0;
|
|
906
888
|
while (this.polling) {
|
|
907
889
|
try {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
onOffsetUpdate?.(this.offset);
|
|
921
|
-
}
|
|
922
|
-
} else {
|
|
923
|
-
const updates = await getUpdates({
|
|
924
|
-
token: this.token,
|
|
925
|
-
baseUrl: this.baseUrl,
|
|
926
|
-
userAgent: this.userAgent,
|
|
927
|
-
timeout,
|
|
928
|
-
offset: this.offset,
|
|
929
|
-
limit
|
|
930
|
-
});
|
|
931
|
-
retryCount = 0;
|
|
932
|
-
for (const update of updates) {
|
|
933
|
-
if (update.message) {
|
|
934
|
-
this.emit("message", { message: update.message, quoteMsgMap: {} });
|
|
935
|
-
this.offset = (update.message.seqId || 0) + 1;
|
|
936
|
-
onOffsetUpdate?.(this.offset);
|
|
937
|
-
}
|
|
938
|
-
}
|
|
890
|
+
const result = await getUpdatesV2({
|
|
891
|
+
token: this.token,
|
|
892
|
+
baseUrl: this.baseUrl,
|
|
893
|
+
userAgent: this.userAgent,
|
|
894
|
+
timeout,
|
|
895
|
+
limit
|
|
896
|
+
});
|
|
897
|
+
retryCount = 0;
|
|
898
|
+
for (const msgUpdate of result.msgs) {
|
|
899
|
+
this.emit("message", { message: msgUpdate.message, quoteMsgMap: result.quoteMsgMap });
|
|
900
|
+
this.offset = (msgUpdate.message.seqId || 0) + 1;
|
|
901
|
+
onOffsetUpdate?.(this.offset);
|
|
939
902
|
}
|
|
940
903
|
await this.sleep(POLLING.SUCCESS_DELAY);
|
|
941
904
|
} catch (error) {
|
|
@@ -959,14 +922,6 @@ var MeetBot = class {
|
|
|
959
922
|
}
|
|
960
923
|
this.emit("polling_stop", void 0);
|
|
961
924
|
}
|
|
962
|
-
async getUpdates(options) {
|
|
963
|
-
return getUpdates({
|
|
964
|
-
token: this.token,
|
|
965
|
-
baseUrl: this.baseUrl,
|
|
966
|
-
userAgent: this.userAgent,
|
|
967
|
-
...options
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
925
|
async getUpdatesV2(options) {
|
|
971
926
|
return getUpdatesV2({
|
|
972
927
|
token: this.token,
|
|
@@ -1120,4 +1075,4 @@ var MeetBot = class {
|
|
|
1120
1075
|
// src/index.ts
|
|
1121
1076
|
init_error();
|
|
1122
1077
|
|
|
1123
|
-
export { API, ApiError, CHUNK_RULES, DEFAULT_BASE_URL, HTTP, MeetBot, MeetBotError, NetworkError, POLLING, SESSION_TYPE, TYPING_ACTION, TimeoutError, UPLOAD, UserCache, ValidationError, completeMultipartUpload, computeMD5, getAccessURL, getChunkNum, getConvID, getMultiPartUploadURL, getQuoteMsgKey,
|
|
1078
|
+
export { API, ApiError, CHUNK_RULES, DEFAULT_BASE_URL, HTTP, MeetBot, MeetBotError, NetworkError, POLLING, SESSION_TYPE, TYPING_ACTION, TimeoutError, UPLOAD, UserCache, ValidationError, completeMultipartUpload, computeMD5, getAccessURL, getChunkNum, getConvID, getMultiPartUploadURL, getQuoteMsgKey, getUpdatesV2, getUploadURL, getUsers, sendMediaMessage, sendMessage, sendUserTyping, uploadFile };
|