ci: moved type-aware linting to pre-commit and ci
This commit is contained in:
parent
976c25141c
commit
fbe264aab0
31 changed files with 76 additions and 63 deletions
28
.eslintrc.ci.js
Normal file
28
.eslintrc.ci.js
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
const baseConfig = require('./.eslintrc.js')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
...baseConfig,
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
...baseConfig.overrides[0],
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/strict-type-checked',
|
||||||
|
'plugin:import/typescript',
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
project: true,
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...baseConfig.overrides[0].rules,
|
||||||
|
'@typescript-eslint/restrict-template-expressions': [
|
||||||
|
'error',
|
||||||
|
{ allowNever: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
reportUnusedDisableDirectives: false,
|
||||||
|
},
|
||||||
|
...baseConfig.overrides.slice(1),
|
||||||
|
],
|
||||||
|
}
|
12
.eslintrc.js
12
.eslintrc.js
|
@ -177,15 +177,11 @@ module.exports = {
|
||||||
files: ['**/*.ts', '**/*.tsx'],
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
env: { browser: true, es6: true, node: true },
|
env: { browser: true, es6: true, node: true },
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@typescript-eslint/strict-type-checked',
|
'plugin:@typescript-eslint/strict',
|
||||||
'plugin:import/typescript',
|
'plugin:import/typescript',
|
||||||
],
|
],
|
||||||
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
|
globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly' },
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
|
||||||
project: true,
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
},
|
|
||||||
plugins: ['@typescript-eslint'],
|
plugins: ['@typescript-eslint'],
|
||||||
rules: {
|
rules: {
|
||||||
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
||||||
|
@ -217,16 +213,14 @@ module.exports = {
|
||||||
'@typescript-eslint/no-confusing-void-expression': 'off',
|
'@typescript-eslint/no-confusing-void-expression': 'off',
|
||||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||||
'@typescript-eslint/no-var-requires': 'off',
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
'@typescript-eslint/restrict-template-expressions': [
|
|
||||||
'error',
|
|
||||||
{ allowNever: true },
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
||||||
'@typescript-eslint/no-invalid-void-type': 'off',
|
'@typescript-eslint/no-invalid-void-type': 'off',
|
||||||
'@typescript-eslint/unbound-method': 'off',
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
'@typescript-eslint/no-dynamic-delete': 'off',
|
'@typescript-eslint/no-dynamic-delete': 'off',
|
||||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||||
},
|
},
|
||||||
|
reportUnusedDisableDirectives: false,
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
node: true,
|
node: true,
|
||||||
|
|
3
.github/workflows/test.yaml
vendored
3
.github/workflows/test.yaml
vendored
|
@ -11,7 +11,6 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
# This job uses a matrix strategy to run the job four times, once for each specified Node version. For more information, see "[AUTOTITLE](/actions/using-jobs/using-a-matrix-for-your-jobs)."
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x, 20.x]
|
node-version: [16.x, 18.x, 20.x]
|
||||||
|
@ -33,5 +32,5 @@ jobs:
|
||||||
- name: 'ESLint'
|
- name: 'ESLint'
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||||
run: pnpm run lint
|
run: pnpm run lint:ci
|
||||||
- run: pnpm run test:all
|
- run: pnpm run test:all
|
|
@ -1,6 +1,7 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const packagesDir = path.join(__dirname, 'packages')
|
const packagesDir = path.join(__dirname, 'packages')
|
||||||
|
const eslintCiConfig = path.join(__dirname, '.eslintrc.ci.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'*.{js,jsx,ts,tsx}': (filenames) => {
|
'*.{js,jsx,ts,tsx}': (filenames) => {
|
||||||
|
@ -13,7 +14,7 @@ module.exports = {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
`prettier --write ${filenames.join(' ')}`,
|
`prettier --write ${filenames.join(' ')}`,
|
||||||
`eslint --fix ${filenames.join(' ')}`,
|
`eslint -c ${eslintCiConfig} --fix ${filenames.join(' ')}`,
|
||||||
...[...modifiedPackages].map((pkg) => `pnpm -C packages/${pkg} run --if-present build --noEmit`)
|
...[...modifiedPackages].map((pkg) => `pnpm -C packages/${pkg} run --if-present build --noEmit`)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"postinstall": "node scripts/validate-deps-versions.mjs",
|
"postinstall": "node scripts/validate-deps-versions.mjs",
|
||||||
"test:all": "pnpm run -r test",
|
"test:all": "pnpm run -r test",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"lint:ci": "eslint --config .eslintrc.ci.js .",
|
||||||
"lint:tsc": "pnpm run -r build --noEmit",
|
"lint:tsc": "pnpm run -r build --noEmit",
|
||||||
"lint:fix": "eslint --fix .",
|
"lint:fix": "eslint --fix .",
|
||||||
"format": "prettier --write \"packages/**/*.ts\"",
|
"format": "prettier --write \"packages/**/*.ts\"",
|
||||||
|
|
|
@ -2124,13 +2124,11 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
* Approve or deny multiple join requests to a chat.
|
* Approve or deny multiple join requests to a chat.
|
||||||
*
|
*
|
||||||
* @param peer Chat/channel ID
|
* @param peer Chat/channel ID
|
||||||
* @param user User ID
|
|
||||||
* @param action Whether to approve or deny the join requests
|
* @param action Whether to approve or deny the join requests
|
||||||
* @param link Invite link to target
|
* @param link Invite link to target
|
||||||
*/
|
*/
|
||||||
hideAllJoinRequests(
|
hideAllJoinRequests(
|
||||||
peer: InputPeerLike,
|
peer: InputPeerLike,
|
||||||
user: InputPeerLike,
|
|
||||||
action: 'approve' | 'deny',
|
action: 'approve' | 'deny',
|
||||||
link?: string
|
link?: string
|
||||||
): Promise<void>
|
): Promise<void>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
rules: {
|
|
||||||
// common when using preprocessor directives
|
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
// @copy
|
// @copy
|
||||||
import { Readable } from 'stream'
|
import { Readable } from 'stream'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
|
|
||||||
// @extension
|
// @extension
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { assertNever } from '@mtcute/core'
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { BotCommands, MtInvalidPeerTypeError } from '../../types'
|
import { BotCommands } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, Message, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike, Message } from '../../types'
|
||||||
import { normalizeInlineId } from '../../utils/inline-utils'
|
import { normalizeInlineId } from '../../utils/inline-utils'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
||||||
|
|
||||||
// @alias=deleteSupergroup
|
// @alias=deleteSupergroup
|
||||||
|
@ -15,7 +15,10 @@ export async function deleteChannel(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const res = await this.call({
|
const res = await this.call({
|
||||||
_: 'channels.deleteChannel',
|
_: 'channels.deleteChannel',
|
||||||
channel: normalizeToInputChannel(await this.resolvePeer(chatId), chatId),
|
channel: normalizeToInputChannel(
|
||||||
|
await this.resolvePeer(chatId),
|
||||||
|
chatId,
|
||||||
|
),
|
||||||
})
|
})
|
||||||
this._handleUpdate(res)
|
this._handleUpdate(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { tl } from '@mtcute/tl'
|
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { isInputPeerChannel, normalizeToInputChannel } from '../../utils/peer-utils'
|
import { isInputPeerChannel } from '../../utils/peer-utils'
|
||||||
import { createDummyUpdate } from '../../utils/updates-utils'
|
import { createDummyUpdate } from '../../utils/updates-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,11 +36,7 @@ export async function deleteHistory(
|
||||||
|
|
||||||
if (isInputPeerChannel(peer)) {
|
if (isInputPeerChannel(peer)) {
|
||||||
this._handleUpdate(
|
this._handleUpdate(
|
||||||
createDummyUpdate(
|
createDummyUpdate(res.pts, res.ptsCount, peer.channelId),
|
||||||
res.pts,
|
|
||||||
res.ptsCount,
|
|
||||||
peer.channelId,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
this._handleUpdate(createDummyUpdate(res.pts, res.ptsCount))
|
this._handleUpdate(createDummyUpdate(res.pts, res.ptsCount))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
||||||
import { createDummyUpdate } from '../../utils/updates-utils'
|
import { createDummyUpdate } from '../../utils/updates-utils'
|
||||||
|
|
||||||
|
@ -17,7 +17,10 @@ export async function deleteUserHistory(
|
||||||
chatId: InputPeerLike,
|
chatId: InputPeerLike,
|
||||||
participantId: InputPeerLike,
|
participantId: InputPeerLike,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const channel = normalizeToInputChannel(await this.resolvePeer(chatId), chatId)
|
const channel = normalizeToInputChannel(
|
||||||
|
await this.resolvePeer(chatId),
|
||||||
|
chatId,
|
||||||
|
)
|
||||||
|
|
||||||
const peer = await this.resolvePeer(participantId)
|
const peer = await this.resolvePeer(participantId)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import {
|
import {
|
||||||
normalizeToInputChannel,
|
normalizeToInputChannel,
|
||||||
normalizeToInputUser,
|
normalizeToInputUser,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { Chat, InputPeerLike, MtPeerNotFoundError } from '../../types'
|
import { Chat, InputPeerLike } from '../../types'
|
||||||
import {
|
import {
|
||||||
INVITE_LINK_REGEX,
|
INVITE_LINK_REGEX,
|
||||||
normalizeToInputChannel,
|
normalizeToInputChannel,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,10 @@ export async function setChatUsername(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this.call({
|
await this.call({
|
||||||
_: 'channels.updateUsername',
|
_: 'channels.updateUsername',
|
||||||
channel: normalizeToInputChannel(await this.resolvePeer(chatId), chatId),
|
channel: normalizeToInputChannel(
|
||||||
|
await this.resolvePeer(chatId),
|
||||||
|
chatId,
|
||||||
|
),
|
||||||
username: username || '',
|
username: username || '',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
import { normalizeToInputChannel } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,10 @@ export async function setSlowMode(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const res = await this.call({
|
const res = await this.call({
|
||||||
_: 'channels.toggleSlowMode',
|
_: 'channels.toggleSlowMode',
|
||||||
channel: normalizeToInputChannel(await this.resolvePeer(chatId), chatId),
|
channel: normalizeToInputChannel(
|
||||||
|
await this.resolvePeer(chatId),
|
||||||
|
chatId,
|
||||||
|
),
|
||||||
seconds,
|
seconds,
|
||||||
})
|
})
|
||||||
this._handleUpdate(res)
|
this._handleUpdate(res)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError, User } from '../../types'
|
import { InputPeerLike, User } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-disable dot-notation */
|
/* eslint-disable @typescript-eslint/no-unused-vars, dot-notation */
|
||||||
import { getMarkedPeerId } from '@mtcute/core'
|
import { getMarkedPeerId } from '@mtcute/core'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Approve or deny multiple join requests to a chat.
|
* Approve or deny multiple join requests to a chat.
|
||||||
*
|
*
|
||||||
* @param peer Chat/channel ID
|
* @param peer Chat/channel ID
|
||||||
* @param user User ID
|
|
||||||
* @param action Whether to approve or deny the join requests
|
* @param action Whether to approve or deny the join requests
|
||||||
* @param link Invite link to target
|
* @param link Invite link to target
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -14,12 +12,9 @@ import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
export async function hideAllJoinRequests(
|
export async function hideAllJoinRequests(
|
||||||
this: TelegramClient,
|
this: TelegramClient,
|
||||||
peer: InputPeerLike,
|
peer: InputPeerLike,
|
||||||
user: InputPeerLike,
|
|
||||||
action: 'approve' | 'deny',
|
action: 'approve' | 'deny',
|
||||||
link?: string,
|
link?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const userId = normalizeToInputUser(await this.resolvePeer(user), user)
|
|
||||||
|
|
||||||
await this.call({
|
await this.call({
|
||||||
_: 'messages.hideAllChatJoinRequests',
|
_: 'messages.hideAllChatJoinRequests',
|
||||||
approved: action === 'approve',
|
approved: action === 'approve',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,13 +4,11 @@ import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import {
|
import {
|
||||||
BotKeyboard,
|
|
||||||
InputMediaLike,
|
InputMediaLike,
|
||||||
InputPeerLike,
|
InputPeerLike,
|
||||||
Message,
|
Message,
|
||||||
MtMessageNotFoundError,
|
MtMessageNotFoundError,
|
||||||
PeersIndex,
|
PeersIndex,
|
||||||
ReplyMarkup,
|
|
||||||
} from '../../types'
|
} from '../../types'
|
||||||
import { normalizeDate, normalizeMessageId } from '../../utils/misc-utils'
|
import { normalizeDate, normalizeMessageId } from '../../utils/misc-utils'
|
||||||
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
||||||
|
|
|
@ -5,7 +5,6 @@ import {
|
||||||
MtTypeAssertionError,
|
MtTypeAssertionError,
|
||||||
} from '@mtcute/core'
|
} from '@mtcute/core'
|
||||||
import { assertTypeIs } from '@mtcute/core/utils'
|
import { assertTypeIs } from '@mtcute/core/utils'
|
||||||
import { tl } from '@mtcute/tl'
|
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { IMessageEntityParser } from '../../types'
|
import { IMessageEntityParser } from '../../types'
|
||||||
|
|
||||||
|
@ -12,6 +13,3 @@ function _initializeParseModes(this: TelegramClient) {
|
||||||
this._parseModes = new Map()
|
this._parseModes = new Map()
|
||||||
this._defaultParseMode = null
|
this._defaultParseMode = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// since IMessageEntityParser is copied here, we don't need to
|
|
||||||
// worry about marking it with @copy anywhere else.
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ interface PendingUpdate {
|
||||||
peers?: PeersIndex
|
peers?: PeersIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
// @extension
|
// @extension
|
||||||
interface UpdatesState {
|
interface UpdatesState {
|
||||||
_updatesLoopActive: boolean
|
_updatesLoopActive: boolean
|
||||||
|
@ -82,6 +83,7 @@ interface UpdatesState {
|
||||||
|
|
||||||
_updsLog: Logger
|
_updsLog: Logger
|
||||||
}
|
}
|
||||||
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
||||||
|
|
||||||
// @initialize
|
// @initialize
|
||||||
function _initializeUpdates(this: TelegramClient) {
|
function _initializeUpdates(this: TelegramClient) {
|
||||||
|
@ -660,6 +662,7 @@ function _isMessageEmpty(upd: tl.TypeUpdate): boolean {
|
||||||
export function _handleUpdate(
|
export function _handleUpdate(
|
||||||
this: TelegramClient,
|
this: TelegramClient,
|
||||||
update: tl.TypeUpdates,
|
update: tl.TypeUpdates,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
noDispatch = false, // fixme
|
noDispatch = false, // fixme
|
||||||
): void {
|
): void {
|
||||||
this._updsLog.debug(
|
this._updsLog.debug(
|
||||||
|
@ -826,8 +829,6 @@ async function _fetchChannelDifference(
|
||||||
limit = 1
|
limit = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
let isFirst = true
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const diff = await this.call(
|
const diff = await this.call(
|
||||||
{
|
{
|
||||||
|
@ -840,7 +841,6 @@ async function _fetchChannelDifference(
|
||||||
},
|
},
|
||||||
// { flush: !isFirst }
|
// { flush: !isFirst }
|
||||||
)
|
)
|
||||||
isFirst = false
|
|
||||||
|
|
||||||
if (diff._ === 'updates.channelDifferenceEmpty') {
|
if (diff._ === 'updates.channelDifferenceEmpty') {
|
||||||
this._updsLog.debug(
|
this._updsLog.debug(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { Chat, InputPeerLike, MtInvalidPeerTypeError } from '../../types'
|
import { Chat, InputPeerLike } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Long from 'long'
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError, Photo } from '../../types'
|
import { InputPeerLike, Photo } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Long from 'long'
|
||||||
import { tl } from '@mtcute/tl'
|
import { tl } from '@mtcute/tl'
|
||||||
|
|
||||||
import { TelegramClient } from '../../client'
|
import { TelegramClient } from '../../client'
|
||||||
import { InputPeerLike, MtInvalidPeerTypeError, Photo } from '../../types'
|
import { InputPeerLike, Photo } from '../../types'
|
||||||
import { normalizeToInputUser } from '../../utils/peer-utils'
|
import { normalizeToInputUser } from '../../utils/peer-utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue