refactor: import tl from core/client, not tl

This commit is contained in:
alina 🌸 2023-09-24 03:37:34 +03:00
parent e771e592fd
commit 7ff433ed0a
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
158 changed files with 197 additions and 346 deletions

View file

@ -14,7 +14,6 @@
},
"dependencies": {
"@types/node": "18.16.0",
"@mtcute/tl": "workspace:^160.0.0",
"@mtcute/core": "workspace:^1.0.0",
"@mtcute/file-id": "workspace:^1.0.0",
"eager-async-pool": "1.0.0",

View file

@ -31,12 +31,7 @@ ${text}`,
async function addSingleMethod(state, fileName) {
const fileFullText = await fs.promises.readFile(fileName, 'utf-8')
const program = ts.createSourceFile(
path.basename(fileName),
fileFullText,
ts.ScriptTarget.ES2018,
true,
)
const program = ts.createSourceFile(path.basename(fileName), fileFullText, ts.ScriptTarget.ES2018, true)
const relPath = path.relative(targetDir, fileName).replace(/\\/g, '/') // replace path delim to unix
state.files[relPath] = fileFullText
@ -64,8 +59,7 @@ async function addSingleMethod(state, fileName) {
if (
!stmt.importClause.namedBindings ||
stmt.importClause.namedBindings.kind !==
ts.SyntaxKind.NamedImports
stmt.importClause.namedBindings.kind !== ts.SyntaxKind.NamedImports
) {
throwError(stmt, fileName, 'Only named imports are supported!')
}
@ -74,25 +68,16 @@ async function addSingleMethod(state, fileName) {
if (module[0] === '.') {
// relative, need to resolve
const modFullPath = path.join(
path.dirname(fileName),
stmt.moduleSpecifier.text,
)
const modFullPath = path.join(path.dirname(fileName), stmt.moduleSpecifier.text)
const modPath = path.dirname(modFullPath)
const modName = path.basename(modFullPath)
module = path
.join(path.relative(targetDir, modPath), modName)
.replace(/\\/g, '/') // replace path delim to unix
module = path.join(path.relative(targetDir, modPath), modName).replace(/\\/g, '/') // replace path delim to unix
if (module[0] !== '.') module = './' + module
}
if (module === './client') {
throwError(
stmt,
fileName,
"You can't copy an import from ./client",
)
throwError(stmt, fileName, "You can't copy an import from ./client")
}
if (!(module in state.imports)) {
@ -119,9 +104,7 @@ async function addSingleMethod(state, fileName) {
name !== '_normalizeInputFile' &&
name !== '_normalizeInputMedia'
const isExported = (stmt.modifiers || []).find(
(mod) => mod.kind === ts.SyntaxKind.ExportKeyword,
)
const isExported = (stmt.modifiers || []).find((mod) => mod.kind === ts.SyntaxKind.ExportKeyword)
const isInitialize = checkForFlag(stmt, '@initialize')
const aliases = (function () {
const flag = checkForFlag(stmt, '@alias')
@ -146,11 +129,7 @@ async function addSingleMethod(state, fileName) {
}
if (isInitialize && isExported) {
throwError(
isExported,
fileName,
'Initialization methods must not be exported',
)
throwError(isExported, fileName, 'Initialization methods must not be exported')
}
if (isInitialize) {
@ -171,8 +150,7 @@ async function addSingleMethod(state, fileName) {
if (
isExported &&
(!firstArg ||
(firstArg.type.getText() !== 'TelegramClient' &&
firstArg.type.getText() !== 'BaseTelegramClient'))
(firstArg.type.getText() !== 'TelegramClient' && firstArg.type.getText() !== 'BaseTelegramClient'))
) {
throwError(
firstArg || stmt.name,
@ -183,16 +161,10 @@ async function addSingleMethod(state, fileName) {
const returnsExported = (
stmt.body ?
ts.getLeadingCommentRanges(
fileFullText,
stmt.body.pos + 2,
) ||
ts.getLeadingCommentRanges(fileFullText, stmt.body.pos + 2) ||
(stmt.statements &&
stmt.statements.length &&
ts.getLeadingCommentRanges(
fileFullText,
stmt.statements[0].pos,
)) ||
ts.getLeadingCommentRanges(fileFullText, stmt.statements[0].pos)) ||
[] :
[]
)
@ -246,23 +218,13 @@ async function addSingleMethod(state, fileName) {
}
if (!checkForFlag(stmt, '@extension')) continue
const isExported = (stmt.modifiers || []).find(
(mod) => mod.kind === 92, /* ExportKeyword */
)
const isExported = (stmt.modifiers || []).find((mod) => mod.kind === 92 /* ExportKeyword */)
if (isExported) {
throwError(
isExported,
fileName,
'Extension interfaces must not be imported',
)
throwError(isExported, fileName, 'Extension interfaces must not be imported')
}
if (stmt.heritageClauses && stmt.heritageClauses.length) {
throwError(
stmt.heritageClauses[0],
fileName,
'Extension interfaces must not be extended',
)
throwError(stmt.heritageClauses[0], fileName, 'Extension interfaces must not be extended')
}
for (const member of stmt.members || []) {
@ -278,9 +240,7 @@ async function addSingleMethod(state, fileName) {
}
async function main() {
const output = fs.createWriteStream(
path.join(__dirname, '../src/client.ts'),
)
const output = fs.createWriteStream(path.join(__dirname, '../src/client.ts'))
const state = {
imports: {},
fields: [],
@ -302,8 +262,7 @@ async function main() {
output.write(
'/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging, @typescript-eslint/unified-signatures */\n' +
'/* THIS FILE WAS AUTO-GENERATED */\n' +
"import { BaseTelegramClient, BaseTelegramClientOptions } from '@mtcute/core'\n" +
"import { tl } from '@mtcute/tl'\n",
"import { BaseTelegramClient, BaseTelegramClientOptions, tl } from '@mtcute/core'\n",
)
Object.entries(state.imports).forEach(([module, items]) => {
items = [...items]
@ -316,9 +275,7 @@ async function main() {
output.write(`// from ${from}\n${code}\n`)
})
output.write(
'\nexport interface TelegramClient extends BaseTelegramClient {\n',
)
output.write('\nexport interface TelegramClient extends BaseTelegramClient {\n')
output.write(`/**
* Register a raw update handler
@ -342,9 +299,7 @@ async function main() {
* @param name Event name
* @param handler ${updates.toSentence(type, 'full')}
*/
on(name: '${type.typeName}', handler: ((upd: ${
type.updateType
}) => void)): this\n`)
on(name: '${type.typeName}', handler: ((upd: ${type.updateType}) => void)): this\n`)
})
const printer = ts.createPrinter()
@ -365,13 +320,9 @@ on(name: '${type.typeName}', handler: ((upd: ${
// first let's determine the signature
const returnType = func.type ? ': ' + func.type.getText() : ''
const generics = func.typeParameters ?
`<${func.typeParameters
.map((it) => it.getFullText())
.join(', ')}>` :
`<${func.typeParameters.map((it) => it.getFullText()).join(', ')}>` :
''
const rawParams = (func.parameters || []).filter(
(it) => !it.type || it.type.getText() !== 'TelegramClient',
)
const rawParams = (func.parameters || []).filter((it) => !it.type || it.type.getText() !== 'TelegramClient')
const parameters = rawParams
.map((it) => {
if (it.initializer) {
@ -382,33 +333,20 @@ on(name: '${type.typeName}', handler: ((upd: ${
// no explicit type.
// infer from initializer
if (
it.initializer.kind ===
ts.SyntaxKind.TrueKeyword ||
it.initializer.kind ===
ts.SyntaxKind.FalseKeyword
it.initializer.kind === ts.SyntaxKind.TrueKeyword ||
it.initializer.kind === ts.SyntaxKind.FalseKeyword
) {
it.type = { kind: ts.SyntaxKind.BooleanKeyword }
} else if (
it.initializer.kind ===
ts.SyntaxKind.StringLiteral
) {
} else if (it.initializer.kind === ts.SyntaxKind.StringLiteral) {
it.type = { kind: ts.SyntaxKind.StringKeyword }
} else if (
it.initializer.kind ===
ts.SyntaxKind.NumericLiteral ||
(it.initializer.kind ===
ts.SyntaxKind.Identifier &&
(it.initializer.escapedText === 'NaN' ||
it.initializer.escapedText ===
'Infinity'))
it.initializer.kind === ts.SyntaxKind.NumericLiteral ||
(it.initializer.kind === ts.SyntaxKind.Identifier &&
(it.initializer.escapedText === 'NaN' || it.initializer.escapedText === 'Infinity'))
) {
it.type = { kind: ts.SyntaxKind.NumberKeyword }
} else {
throwError(
it,
state.methods.used[origName],
'Cannot infer parameter type',
)
throwError(it, state.methods.used[origName], 'Cannot infer parameter type')
}
}
it.initializer = undefined
@ -445,12 +383,8 @@ on(name: '${type.typeName}', handler: ((upd: ${
comment = comment
.replace(/^\s*\/\/+\s*@alias.*$/m, '')
.replace(/(\n^|\/\*)\s*\*\s*@internal.*/m, '')
.replace(
/((?:\n^|\/\*)\s*\*\s*@param )([^\s]+?)($|\s+)/gm,
(_, pref, arg, post) => {
const param = rawParams.find(
(it) => it.name.escapedText === arg,
)
.replace(/((?:\n^|\/\*)\s*\*\s*@param )([^\s]+?)($|\s+)/gm, (_, pref, arg, post) => {
const param = rawParams.find((it) => it.name.escapedText === arg)
if (!param) return _
if (!param._savedDefault) return _
@ -459,8 +393,7 @@ on(name: '${type.typeName}', handler: ((upd: ${
}
return `${pref}${arg}\n* (default: \`${param._savedDefault.trim()}\`)`
},
)
})
for (const name of [origName, ...aliases]) {
if (!hasOverloads) {
@ -469,9 +402,7 @@ on(name: '${type.typeName}', handler: ((upd: ${
output.write(comment + '\n')
}
output.write(
`${name}${generics}(${parameters})${returnType}\n`,
)
output.write(`${name}${generics}(${parameters})${returnType}\n`)
}
if (!overload) {

View file

@ -2,10 +2,9 @@
/* THIS FILE WAS AUTO-GENERATED */
import { Readable } from 'stream'
import { BaseTelegramClient, BaseTelegramClientOptions, MaybeArray, MaybeAsync } from '@mtcute/core'
import { BaseTelegramClient, BaseTelegramClientOptions, MaybeArray, MaybeAsync, tl } from '@mtcute/core'
import { AsyncLock, ConditionVariable, Deque, Logger, SortedLinkedList } from '@mtcute/core/utils'
import { tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { acceptTos } from './methods/auth/accept-tos'
import { checkPassword } from './methods/auth/check-password'

View file

@ -1,6 +1,5 @@
/* eslint-disable no-console */
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { MaybeAsync, MaybeDynamic, SentCode, TermsOfService, User } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotInline, InputInlineResult } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotCommands } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { computeSrpParams } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { GameHighScore, InputPeerLike, PeersIndex } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotCommands } from '../../types'

View file

@ -1,5 +1,4 @@
import { assertNever } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { assertNever, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotCommands } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, Message } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotCommands } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,5 +1,4 @@
import { MaybeArray } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MaybeArray, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,7 +1,6 @@
import Long from 'long'
import { assertNever, MaybeArray } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { assertNever, MaybeArray, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { ChatAction, ChatEvent, InputPeerLike, PeersIndex } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { ChatMember, InputPeerLike, MtInvalidPeerTypeError, PeersIndex } from '../../types'

View file

@ -1,8 +1,7 @@
import Long from 'long'
import { assertNever } from '@mtcute/core'
import { assertNever, tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { ArrayWithTotal, ChatMember, InputPeerLike, MtInvalidPeerTypeError, PeersIndex } from '../../types'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Chat, InputPeerLike } from '../../types'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Chat, InputPeerLike } from '../../types'

View file

@ -1,6 +1,5 @@
import { getMarkedPeerId } from '@mtcute/core'
import { getMarkedPeerId, tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { Chat } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, MtInvalidPeerTypeError } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Chat, InputPeerLike } from '../../types'

View file

@ -1,6 +1,5 @@
import { MtArgumentError } from '@mtcute/core'
import { MtArgumentError, tl } from '@mtcute/core'
import { fileIdToInputPhoto, tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputFileLike, InputPeerLike, isUploadedFile, MtInvalidPeerTypeError } from '../../types'

View file

@ -1,5 +1,4 @@
import { MaybeArray } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MaybeArray, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,7 +1,6 @@
import Long from 'long'
import { PartialOnly } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { PartialOnly, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,5 +1,4 @@
import { PartialExcept } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { PartialExcept, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,7 +1,6 @@
import Long from 'long'
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Dialog } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'

View file

@ -1,6 +1,5 @@
import { getMarkedPeerId } from '@mtcute/core'
import { getMarkedPeerId, tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { Dialog, PeersIndex } from '../../types'

View file

@ -1,7 +1,6 @@
import { ConnectionKind, MtArgumentError, MtUnsupportedError } from '@mtcute/core'
import { ConnectionKind, MtArgumentError, MtUnsupportedError, tl } from '@mtcute/core'
import { ConditionVariable } from '@mtcute/core/utils'
import { fileIdToInputFileLocation, fileIdToInputWebFileLocation, parseFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { FileDownloadParameters, FileLocation } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputFileLike } from '../../types'

View file

@ -1,6 +1,5 @@
import { MtArgumentError } from '@mtcute/core'
import { MtArgumentError, tl } from '@mtcute/core'
import { tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputFileLike, isUploadedFile } from '../../types'

View file

@ -1,8 +1,8 @@
import Long from 'long'
import { tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { fileIdToInputDocument, fileIdToInputPhoto, parseFileId, tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputMediaLike, isUploadedFile, UploadFileLike } from '../../types'

View file

@ -2,9 +2,8 @@ import { fromBuffer as fileTypeFromBuffer } from 'file-type'
import type { ReadStream } from 'fs'
import { Readable } from 'stream'
import { MtArgumentError } from '@mtcute/core'
import { MtArgumentError, tl } from '@mtcute/core'
import { AsyncLock, randomLong } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { UploadedFile, UploadFileLike } from '../../types'

View file

@ -83,5 +83,6 @@ export async function uploadMedia(
throw new MtArgumentError("This media (story) can't be uploaded")
default:
assertNever(normMedia)
// ^?
}
}

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { ChatInviteLinkJoinedMember, InputPeerLike, PeersIndex, User } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { ChatInviteLink, InputPeerLike, PeersIndex } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotKeyboard, FormattedString, InputMediaLike, ReplyMarkup } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { BotKeyboard, FormattedString, InputMediaLike, InputPeerLike, Message, ReplyMarkup } from '../../types'

View file

@ -1,5 +1,4 @@
import { MtTypeAssertionError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtTypeAssertionError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Message, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
import { MaybeArray, MtArgumentError } from '@mtcute/core'
import { MaybeArray, MtArgumentError, tl } from '@mtcute/core'
import { randomLong } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { FormattedString, InputMediaLike, InputPeerLike, Message, PeersIndex } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, Message, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
import { MaybeArray } from '@mtcute/core'
import { MaybeArray, tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { Message, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
import { MaybeArray } from '@mtcute/core'
import { MaybeArray, tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputPeerLike, Message, PeersIndex } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, PeerReaction, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { FormattedString } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { Message, PeersIndex, SearchFilters } from '../../types'

View file

@ -1,7 +1,7 @@
import Long from 'long'
import { tl } from '@mtcute/core'
import { assertTypeIsNot } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputPeerLike, Message, PeersIndex, SearchFilters } from '../../types'

View file

@ -1,5 +1,4 @@
import { getMarkedPeerId } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { getMarkedPeerId, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { FormattedString, InputPeerLike, Message, MtMessageNotFoundError, ReplyMarkup } from '../../types'

View file

@ -1,6 +1,5 @@
import { getMarkedPeerId, MtArgumentError } from '@mtcute/core'
import { getMarkedPeerId, MtArgumentError, tl } from '@mtcute/core'
import { randomLong } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputMediaLike, InputPeerLike, Message, MtMessageNotFoundError, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
import { getMarkedPeerId, MtArgumentError } from '@mtcute/core'
import { getMarkedPeerId, MtArgumentError, tl } from '@mtcute/core'
import { randomLong } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import {

View file

@ -1,7 +1,6 @@
import Long from 'long'
import { MtTypeAssertionError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtTypeAssertionError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, Message, PeersIndex } from '../../types'

View file

@ -1,6 +1,5 @@
import { getMarkedPeerId, MtArgumentError, MtTypeAssertionError } from '@mtcute/core'
import { getMarkedPeerId, MtArgumentError, MtTypeAssertionError, tl } from '@mtcute/core'
import { randomLong } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import {

View file

@ -1,5 +1,4 @@
import { assertNever } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { assertNever, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, TypingStatus } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { TakeoutSession } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputStickerSetItem, StickerSet } from '../../types'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import {

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { fileIdToInputDocument, tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { StickerSet } from '../../types'

View file

@ -1,6 +1,5 @@
import { MtTypeAssertionError } from '@mtcute/core'
import { MtTypeAssertionError, tl } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { Sticker } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { StickerSet } from '../../types'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { fileIdToInputDocument, tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { StickerSet } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputFileLike, StickerSet } from '../../types'

View file

@ -1,5 +1,5 @@
/* eslint-disable max-depth */
import { assertNever, MtArgumentError } from '@mtcute/core'
import { assertNever, MtArgumentError, tl } from '@mtcute/core'
import {
AsyncLock,
ConditionVariable,
@ -11,7 +11,6 @@ import {
SortedLinkedList,
toggleChannelIdMark,
} from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../client'
import { PeersIndex } from '../types'

View file

@ -1,6 +1,5 @@
import { MaybeArray } from '@mtcute/core'
import { MaybeArray, tl } from '@mtcute/core'
import { fileIdToInputPhoto } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'

View file

@ -1,6 +1,6 @@
import Long from 'long'
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, Photo } from '../../types'

View file

@ -1,6 +1,6 @@
import Long from 'long'
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike, Photo } from '../../types'

View file

@ -1,6 +1,6 @@
import { asyncPool } from 'eager-async-pool'
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { InputPeerLike } from '../../types'

View file

@ -1,8 +1,7 @@
import Long from 'long'
import { getBasicPeerType, getMarkedPeerId, MtTypeAssertionError, toggleChannelIdMark } from '@mtcute/core'
import { getBasicPeerType, getMarkedPeerId, MtTypeAssertionError, tl, toggleChannelIdMark } from '@mtcute/core'
import { assertTypeIs } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputPeerLike, MtPeerNotFoundError } from '../../types'

View file

@ -1,6 +1,5 @@
import { MtArgumentError } from '@mtcute/core'
import { MtArgumentError, tl } from '@mtcute/core'
import { fileIdToInputPhoto, tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { InputFileLike, Photo } from '../../types'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { makeInspectable } from '../utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { MessageEntity } from '../messages'
import { makeInspectable } from '../utils'

View file

@ -1,5 +1,4 @@
import { BasicPeerType, getBasicPeerType, getMarkedPeerId, MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { BasicPeerType, getBasicPeerType, getMarkedPeerId, MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { encodeInlineMessageId } from '../../utils/inline-utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { InputPeerLike } from '../peers'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { PeersIndex, User } from '../peers'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Location } from '../media'

View file

@ -1,5 +1,4 @@
import { assertNever } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { assertNever, tl } from '@mtcute/core'
import { TelegramClient } from '../../../client'
import { InputMediaContact, InputMediaGeo, InputMediaGeoLive, InputMediaVenue } from '../../media'

View file

@ -1,6 +1,5 @@
import { MtArgumentError } from '@mtcute/core'
import { MtArgumentError, tl } from '@mtcute/core'
import { fileIdToInputDocument, fileIdToInputPhoto } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../../client'
import { extractFileName } from '../../../utils/file-utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import type { InlineKeyboardMarkup, ReplyKeyboardMarkup } from './keyboards'

View file

@ -1,5 +1,4 @@
import { assertNever } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { assertNever, tl } from '@mtcute/core'
import { normalizeToInputUser } from '../../utils/peer-utils'
import { BotKeyboardBuilder } from './keyboard-builder'

View file

@ -1,3 +1,5 @@
import { assertNever, tl } from '@mtcute/core'
/**
* Phone call discard reason. Can be:
* - `missed`: The call was missed
@ -5,9 +7,6 @@
* - `hangup`: The call was ended normally
* - `busy`: The call was discarded because the user is in another call
*/
import { assertNever } from '@mtcute/core'
import { tl } from '@mtcute/tl'
export type CallDiscardReason = 'missed' | 'disconnect' | 'hangup' | 'busy'
/** @internal */

View file

@ -1,7 +1,6 @@
/* eslint-disable dot-notation */
import { getMarkedPeerId, MaybeAsync, MtArgumentError, MtTimeoutError } from '@mtcute/core'
import { getMarkedPeerId, MaybeAsync, MtArgumentError, MtTimeoutError, tl } from '@mtcute/core'
import { AsyncLock, ControllablePromise, createControllablePromise, Deque } from '@mtcute/core/utils'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../client'
import { InputMediaLike } from './media'

View file

@ -1,6 +1,6 @@
import { Readable } from 'stream'
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { makeInspectable } from '../utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
/**
* Describes a file uploaded to the Telegram servers

View file

@ -1,8 +1,8 @@
import type { ReadStream } from 'fs'
import type { Readable } from 'stream'
import { tl } from '@mtcute/core'
import { tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { FileLocation } from './file-location'
import { UploadedFile } from './uploaded-file'

View file

@ -1,5 +1,4 @@
import { MtArgumentError } from '@mtcute/core'
import { tl } from '@mtcute/tl'
import { MtArgumentError, tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { makeInspectable } from '../utils'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { tdFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { makeInspectable } from '../utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { makeInspectable } from '../utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { makeInspectable } from '../utils'

View file

@ -1,4 +1,4 @@
import { tl } from '@mtcute/tl'
import { tl } from '@mtcute/core'
import { TelegramClient } from '../../client'
import { Audio } from './audio'

View file

@ -1,5 +1,5 @@
import { tl } from '@mtcute/core'
import { tdFileId as td, toFileId, toUniqueFileId } from '@mtcute/file-id'
import { tl } from '@mtcute/tl'
import { TelegramClient } from '../../client'
import { FileLocation } from '../files'

Some files were not shown because too many files have changed in this diff Show more