chore(core)!: disallow passing api id as string
This commit is contained in:
parent
7a0d8ecef2
commit
dfed3c2761
2 changed files with 2 additions and 8 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue