constructor(options = {}) { super() const defaults = { libraryFile: process.platform === 'win32' && 'tdjson' || 'libtdjson', databaseDirectory: '.tlg', logFile: 'tlg.log', encryptionKey: '', verbosityLevel: 1 } this.options = {...defaults, ...options} this.tdlib = ffi.Library(path.resolve(this.options.libraryFile), { 'td_json_client_create' : ['pointer', []], 'td_json_client_send' : ['void' , ['pointer', 'string']], 'td_json_client_receive' : ['string' , ['pointer', 'double']], 'td_json_client_destroy' : ['void' , ['pointer']], 'td_set_log_file_path' : ['int' , ['string']], 'td_set_log_verbosity_level' : ['void' , ['int']] }) this.tdlib.td_set_log_file_path(path.resolve(this.options.logFile)) this.tdlib.td_set_log_verbosity_level(this.options.verbosityLevel) this.instance = null this.fetching = new Map() }
constructor(options = {}) { super() const defaults = { libraryFile: process.platform === 'win32' && 'tdjson' || 'libtdjson', databaseDirectory: '.tlg', logFile: 'tlg.log', encryptionKey: '', verbosityLevel: 1 } this.options = {...defaults, ...options} this.tdlib = ffi.Library(path.resolve(this.options.libraryFile), { 'td_json_client_create' : ['pointer', []], 'td_json_client_send' : ['void' , ['pointer', 'string']], 'td_json_client_receive' : ['string' , ['pointer', 'double']], 'td_json_client_destroy' : ['void' , ['pointer']], 'td_set_log_file_path' : ['int' , ['string']], 'td_set_log_verbosity_level' : ['void' , ['int']] }) this.tdlib.td_set_log_file_path(path.resolve(this.options.logFile)) this.tdlib.td_set_log_verbosity_level(this.options.verbosityLevel) this.instance = null this.fetching = new Map() }