chore(core)!: disallow passing api id as string

This commit is contained in:
alina 🌸 2023-12-16 19:55:29 +03:00
parent 7a0d8ecef2
commit dfed3c2761
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 2 additions and 8 deletions

View file

@ -93,12 +93,6 @@ export class BaseTelegramClient extends EventEmitter {
constructor(opts: BaseTelegramClientOptions) { constructor(opts: BaseTelegramClientOptions) {
super() super()
const apiId = typeof opts.apiId === 'string' ? parseInt(opts.apiId) : opts.apiId
if (isNaN(apiId)) {
throw new Error('apiId must be a number or a numeric string!')
}
if (opts.logLevel !== undefined) { if (opts.logLevel !== undefined) {
this.log.level = opts.logLevel this.log.level = opts.logLevel
} }
@ -129,7 +123,7 @@ export class BaseTelegramClient extends EventEmitter {
this.network = new NetworkManager( this.network = new NetworkManager(
{ {
apiId, apiId: opts.apiId,
crypto: this.crypto, crypto: this.crypto,
disableUpdates: opts.disableUpdates ?? false, disableUpdates: opts.disableUpdates ?? false,
initConnectionOptions: opts.initConnectionOptions, initConnectionOptions: opts.initConnectionOptions,

View file

@ -11,7 +11,7 @@ export interface BaseTelegramClientOptions {
/** /**
* API ID from my.telegram.org * API ID from my.telegram.org
*/ */
apiId: number | string apiId: number
/** /**
* API hash from my.telegram.org * API hash from my.telegram.org
*/ */