Skip to content

Commit

Permalink
Update layer.
Browse files Browse the repository at this point in the history
remove useless dependencies
  • Loading branch information
painor committed Apr 12, 2024
1 parent ed712aa commit f8710df
Show file tree
Hide file tree
Showing 21 changed files with 2,424 additions and 291 deletions.
4 changes: 3 additions & 1 deletion gramjs/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ export function readBufferFromBigInt(
}

if (signed && bigIntVar.lesser(bigInt(0))) {
bigIntVar = bigInt(2).pow(bigInt(bytesNumber).multiply(8)).add(bigIntVar);
bigIntVar = bigInt(2)
.pow(bigInt(bytesNumber).multiply(8))
.add(bigIntVar);
}

const hex = bigIntVar.toString(16).padStart(bytesNumber * 2, "0");
Expand Down
5 changes: 2 additions & 3 deletions gramjs/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,8 @@ export function _photoSizeByteCount(size: Api.TypePhotoSize) {
} else if (size instanceof Api.PhotoSizeEmpty) {
return 0;
} else if (size instanceof Api.PhotoSizeProgressive) {
return size.sizes[size.sizes.length -1];
}
else {
return size.sizes[size.sizes.length - 1];
} else {
return undefined;
}
}
Expand Down
2 changes: 1 addition & 1 deletion gramjs/Version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "2.20.3";
export const version = "2.20.9";
3 changes: 2 additions & 1 deletion gramjs/client/TelegramClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,8 @@ export class TelegramClient extends TelegramBaseClient {
this._log.error(`Error while trying to reconnect`);
if (this._errorHandler) {
await this._errorHandler(e as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.error(e);
}
}
Expand Down
3 changes: 2 additions & 1 deletion gramjs/client/telegramBaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ export abstract class TelegramBaseClient {
} catch (err) {
if (this._errorHandler) {
await this._errorHandler(err as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.error(err);
}
return this._borrowExportedSender(dcId, true);
Expand Down
6 changes: 4 additions & 2 deletions gramjs/client/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export async function _dispatchUpdate(
}
if (client._errorHandler) {
await client._errorHandler(e as Error);
} if (client._log.canSend(LogLevel.ERROR)) {
}
if (client._log.canSend(LogLevel.ERROR)) {
console.error(e);
}
}
Expand Down Expand Up @@ -245,7 +246,8 @@ export async function _updateLoop(client: TelegramClient) {
// eslint-disable-next-line no-console
if (client._errorHandler) {
await client._errorHandler(err as Error);
} if (client._log.canSend(LogLevel.ERROR)) {
}
if (client._log.canSend(LogLevel.ERROR)) {
console.error(err);
}

Expand Down
3 changes: 2 additions & 1 deletion gramjs/client/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ export async function getInputEntity(
} catch (e) {
if (client._errorHandler) {
await client._errorHandler(e as Error);
} if (client._log.canSend(LogLevel.ERROR)) {
}
if (client._log.canSend(LogLevel.ERROR)) {
console.error(e);
}
}
Expand Down
1 change: 1 addition & 0 deletions gramjs/errors/RPCErrorList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const rpcErrorRe = new Map<RegExp, any>([
[/FILE_MIGRATE_(\d+)/, FileMigrateError],
[/FLOOD_TEST_PHONE_WAIT_(\d+)/, FloodTestPhoneWaitError],
[/FLOOD_WAIT_(\d+)/, FloodWaitError],
[/FLOOD_PREMIUM_WAIT_(\d+)/, FloodWaitError],
[/MSG_WAIT_(.*)/, MsgWaitError],
[/PHONE_MIGRATE_(\d+)/, PhoneMigrateError],
[/SLOWMODE_WAIT_(\d+)/, SlowModeWaitError],
Expand Down
3 changes: 2 additions & 1 deletion gramjs/events/Album.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export class AlbumEvent extends EventCommon {
);
if (client._errorHandler) {
client._errorHandler(e as Error);
} if (client._log.canSend(LogLevel.ERROR)) {
}
if (client._log.canSend(LogLevel.ERROR)) {
console.error(e);
}
}
Expand Down
3 changes: 2 additions & 1 deletion gramjs/events/NewMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ export class NewMessageEvent extends EventCommon {
);
if (client._errorHandler) {
client._errorHandler(e as Error);
} if (client._log.canSend(LogLevel.ERROR)) {
}
if (client._log.canSend(LogLevel.ERROR)) {
console.error(e);
}
}
Expand Down
4 changes: 3 additions & 1 deletion gramjs/extensions/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ export class HTMLParser {
html.push(`<blockquote>${entityText}</blockquote>`);
} else if (entity instanceof Api.MessageEntityPre) {
if (entity.language) {
html.push(`<pre><code class="language-${entity.language}">${entityText}</code></pre>`);
html.push(
`<pre><code class="language-${entity.language}">${entityText}</code></pre>`
);
} else {
html.push(`<pre>${entityText}</pre>`);
}
Expand Down
12 changes: 8 additions & 4 deletions gramjs/network/MTProtoSender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ export class MTProtoSender {
);
if (this._client._errorHandler) {
await this._client._errorHandler(err as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.error(err);
}
await sleep(this._delay);
Expand Down Expand Up @@ -583,7 +584,8 @@ export class MTProtoSender {
this._log.error("Unhandled error while receiving data");
if (this._client._errorHandler) {
await this._client._errorHandler(e as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.log(e);
}
this.reconnect();
Expand All @@ -607,7 +609,8 @@ export class MTProtoSender {
this._log.error("Unhandled error while receiving data");
if (this._client._errorHandler) {
await this._client._errorHandler(e as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.log(e);
}
}
Expand Down Expand Up @@ -986,7 +989,8 @@ export class MTProtoSender {
this._log.warn("Error happened while disconnecting");
if (this._client._errorHandler) {
await this._client._errorHandler(err as Error);
} if (this._log.canSend(LogLevel.ERROR)) {
}
if (this._log.canSend(LogLevel.ERROR)) {
console.error(err);
}
}
Expand Down
2 changes: 1 addition & 1 deletion gramjs/tl/AllTLObjects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const LAYER = 174;
export const LAYER = 177;

import { Api } from "./";

Expand Down
Loading

0 comments on commit f8710df

Please sign in to comment.