@mtcute/core 0.12.0 → 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 +3 -6
- package/cjs/network/client.js +9 -1
- package/cjs/network/client.js.map +1 -1
- package/cjs/network/network-manager.js +1 -1
- package/cjs/network/session-connection.js +1 -0
- package/cjs/network/session-connection.js.map +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 +3 -6
- package/esm/network/client.js +9 -1
- package/esm/network/client.js.map +1 -1
- package/esm/network/network-manager.js +1 -1
- package/esm/network/session-connection.js +1 -0
- package/esm/network/session-connection.js.map +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/esm/highlevel/client.js
CHANGED
|
@@ -254,20 +254,22 @@ export class TelegramClient extends EventEmitter {
|
|
|
254
254
|
this.log = this._client.log;
|
|
255
255
|
// @ts-expect-error codegen
|
|
256
256
|
this.storage = this._client.storage;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
257
|
+
if (!opts.disableUpdates) {
|
|
258
|
+
const skipConversationUpdates = opts.skipConversationUpdates ?? true;
|
|
259
|
+
const { messageGroupingInterval } = opts.updates ?? {};
|
|
260
|
+
this._client.onUpdate(makeParsedUpdateHandler({
|
|
261
|
+
messageGroupingInterval,
|
|
262
|
+
onUpdate: (update) => {
|
|
263
|
+
if (Conversation.handleUpdate(this._client, update) && skipConversationUpdates)
|
|
264
|
+
return;
|
|
265
|
+
this.emit('update', update);
|
|
266
|
+
this.emit(update.name, update.data);
|
|
267
|
+
},
|
|
268
|
+
onRawUpdate: (update, peers) => {
|
|
269
|
+
this.emit('raw_update', update, peers);
|
|
270
|
+
},
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
271
273
|
}
|
|
272
274
|
withParams(params) {
|
|
273
275
|
return withParams(this, params);
|