@mtcute/core 0.12.1 → 0.12.2
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/cjs/highlevel/client.d.ts +8 -0
- package/cjs/highlevel/client.js +16 -14
- package/cjs/highlevel/client.js.map +1 -1
- package/cjs/highlevel/methods/_init.js +16 -14
- package/cjs/highlevel/methods/_init.js.map +1 -1
- package/cjs/network/client.d.ts +1 -5
- package/cjs/network/client.js.map +1 -1
- package/cjs/network/network-manager.js +1 -1
- package/esm/highlevel/client.d.ts +8 -0
- package/esm/highlevel/client.js +16 -14
- package/esm/highlevel/client.js.map +1 -1
- package/esm/highlevel/methods/_init.js +16 -14
- package/esm/highlevel/methods/_init.js.map +1 -1
- package/esm/network/client.d.ts +1 -5
- package/esm/network/client.js.map +1 -1
- package/esm/network/network-manager.js +1 -1
- package/package.json +1 -1
|
@@ -50,6 +50,14 @@ type TelegramClientOptions = ((PartialOnly<Omit<BaseTelegramClientOptions, 'stor
|
|
|
50
50
|
}) | {
|
|
51
51
|
client: ITelegramClient;
|
|
52
52
|
}) & {
|
|
53
|
+
/**
|
|
54
|
+
* If true, all API calls will be wrapped with `tl.invokeWithoutUpdates`,
|
|
55
|
+
* effectively disabling the server-sent events for the clients.
|
|
56
|
+
* May be useful in some cases.
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
disableUpdates?: boolean;
|
|
53
61
|
updates?: Omit<ParsedUpdateHandlerParams, 'onUpdate'>;
|
|
54
62
|
/**
|
|
55
63
|
* If `true`, the updates that were handled by some {@link Conversation}
|
package/cjs/highlevel/client.js
CHANGED
|
@@ -280,20 +280,22 @@ class TelegramClient extends events_1.default {
|
|
|
280
280
|
this.log = this._client.log;
|
|
281
281
|
// @ts-expect-error codegen
|
|
282
282
|
this.storage = this._client.storage;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
283
|
+
if (!opts.disableUpdates) {
|
|
284
|
+
const skipConversationUpdates = opts.skipConversationUpdates ?? true;
|
|
285
|
+
const { messageGroupingInterval } = opts.updates ?? {};
|
|
286
|
+
this._client.onUpdate((0, parsed_js_1.makeParsedUpdateHandler)({
|
|
287
|
+
messageGroupingInterval,
|
|
288
|
+
onUpdate: (update) => {
|
|
289
|
+
if (conversation_js_1.Conversation.handleUpdate(this._client, update) && skipConversationUpdates)
|
|
290
|
+
return;
|
|
291
|
+
this.emit('update', update);
|
|
292
|
+
this.emit(update.name, update.data);
|
|
293
|
+
},
|
|
294
|
+
onRawUpdate: (update, peers) => {
|
|
295
|
+
this.emit('raw_update', update, peers);
|
|
296
|
+
},
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
297
299
|
}
|
|
298
300
|
withParams(params) {
|
|
299
301
|
return (0, with_params_js_1.withParams)(this, params);
|