- Added a new high level API
client.tg.downloadfor downloading files
- Fix WASM verbosity setting for TDLib 1.4.0 (provides official WASM suppor & example)
- Added a new high level API
client.tg.call
WARNING: This release came with multiple breaking changes, please see README.md / examples for updated usages.
- Breaking changes: Removed
dataDiroption in flavor ofappDir - Breaking changes: Removed
authoption - Added support for WebAssembly
- Added a new option
dataDirfor specifying__tglib__data directory. - Added a new option
binaryPathfor specifying TDLib binary. - Added a new high level API
client.tg.getChat. - Fixed issue #36, update loop will now stop when client is destroyed.
- Breaking changes: Rewrote
client.tg.sendTextMessage.
The old way to send text message:
await client.tg.sendTextMessage('123456789', 'Hello *World*', {
'parse_mode': 'markdown',
'disable_notification': true,
'clear_draft': false,
})The new way to send text message:
const { TextStruct } = require('tglib/structs')
await client.tg.sendTextMessage({
'$text': new TextStruct('`Hello` world!', 'textParseModeMarkdown'),
'chat_id': 123456789,
'disable_notification': true,
'clear_draft': false,
})- Added
tglib/structsfor common structures. - Added
TextStructfor formatted text struct, used ininputMessageText.text,inputMessagePhoto.caption, etc.
const text1 = new TextStruct('Normal text')
const text2 = new TextStruct('`Markdown` text', 'textParseModeMarkdown')
const text3 = new TextStruct('<b>HTML</b> text', 'textParseModeHTML')- Added a new high level API
client.tg.sendPhotoMessage.
const { TextStruct } = require('tglib/structs')
await client.tg.sendPhotoMessage({
'$caption': new TextStruct('Such doge much wow'),
'chat_id': 123456789,
'path': '/tmp/doge.jpg',
'ttl': 5,
})- Breaking changes:
client.onnow renamed toclient.registerCallback.
The old way to receive updates and errors:
client.on('_update', (update) => console.log(update))
client.on('_error', (error) => console.error(error))The new way to receive updates and errors:
client.registerCallback('td:update', (update) => console.log(update))
client.registerCallback('td:error', (error) => console.error(error))- Added a new callback
td:getInputto split out thegetInputfunction from core, you can now register your own callback function to handle the login process.
client.registerCallback('td:getInput', async (args) => {
const result = await getInputFromUser(args)
return result
})- Added a new high level API
client.tg.updateUsername. - Added a new high level API
client.tg.getAllChats. - Added a new high level API
client.tg.openSecretChat. - Added a new high level API
client.tg.deleteChat. - Fixes new user authorization. (#24)
- Improve documentations.
- Now support multiple session login by storing files in separate directories. (#16, #19)
- Ability to login as Bots.
const client = new Client({
apiId: 'YOUR_API_ID',
apiHash: 'YOUR_API_HASH',
- phoneNumber: 'YOUR_PHONE_NUMBER',
+ auth: {
+ type: 'user',
+ value: 'YOUR_PHONE_NUMBER',
+ },
})- Error events for
client.fetchare now handled.ClientFetchErrorwill be thrown ifclient.fetchfails. client.tg.sendMessageTypeTextrenamed toclient.tg.sendTextMessage.client.connect()changed toclient.ready.