{"id":20287945,"url":"https://github.com/arpit2438735/nativescript-tglib","last_synced_at":"2025-04-11T10:00:13.906Z","repository":{"id":57308796,"uuid":"161195302","full_name":"arpit2438735/nativescript-tglib","owner":"arpit2438735","description":"Telegram Database Library in Nativescript","archived":false,"fork":false,"pushed_at":"2019-01-19T11:48:44.000Z","size":2098,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T06:51:13.237Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arpit2438735.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-10T15:25:54.000Z","updated_at":"2023-12-19T19:49:31.000Z","dependencies_parsed_at":"2022-08-29T07:41:57.009Z","dependency_job_id":null,"html_url":"https://github.com/arpit2438735/nativescript-tglib","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpit2438735%2Fnativescript-tglib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpit2438735%2Fnativescript-tglib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpit2438735%2Fnativescript-tglib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arpit2438735%2Fnativescript-tglib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arpit2438735","download_url":"https://codeload.github.com/arpit2438735/nativescript-tglib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248372129,"owners_count":21093133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T14:43:27.550Z","updated_at":"2025-04-11T10:00:13.837Z","avatar_url":"https://github.com/arpit2438735.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nativescript Tglib ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png)\n\nNativescript Library for building Telegram clients\n\n## Installation\n\nDescribe your plugin installation steps. Ideally it would be something like:\n\n```javascript\ntns plugin add nativescript-tglib\n```\n\n## Features\n\n- Currently support for iOS\n- Android coming soon\n\n---\n\n### APIs\n\ntglib provide some useful methods that makes your Telegram app development easier.\n\nMost API classes/methods can be found in the official [TDLib documentation](https://core.telegram.org/tdlib/docs/classes.html).\n\n#### Authorizing an user\n\n```js\nconst client = new TDJSON({\n  apiId: 'YOUR_API_ID',\n  apiHash: 'YOUR_API_HASH',\n  auth: {\n    type: 'user',\n    value: 'YOUR_PHONE_NUMBER',\n  },\n})\n```\n\n#### Authorizing a bot\n\n```js\nconst client = new TDJSON({\n  apiId: 'YOUR_API_ID',\n  apiHash: 'YOUR_API_HASH',\n  auth: {\n    type: 'bot',\n    value: 'YOUR_BOT_TOKEN',\n  },\n})\n```\n\n#### ![](https://placehold.it/12/efcf39/000?text=+) Low Level APIs\n\n\n##### `client.ready`\n\n\nThis promise is used for initializing tglib client and connect with Telegram.\n\n```js\nawait client.ready\n```\n##### `client.registerCallback(key, callback)` -\u003e Void\n\n\nThis API is provided by tglib, you can use this API to register your function in order to receive callbacks.\n\nThe authorization process can be overridden here by registering `td:getInput` callback.\n\n```js\nclient.registerCallback('td:update', (update) =\u003e console.log(update))\nclient.registerCallback('td:error', (error) =\u003e console.error(error))\nclient.registerCallback('td:getInput', async (args) =\u003e {\n  const result = await getInputFromUser(args)\n  return result\n})\n```\n\n##### `client.fetch(query)` -\u003e Promise -\u003e Object\n\nThis API is provided by tglib, you can use this API to send asynchronous message to Telegram and receive response.\n\n```js\nconst chats = await client.fetch({\n  '@type': 'getChats',\n  'offset_order': '9223372036854775807',\n  'offset_chat_id': 0,\n  'limit': 100,\n})\n```\n\n##### `client.send(query)` -\u003e Promise -\u003e Object\n\nThis API is provided by TDLib, you can use this API to send asynchronous message to Telegram.\n\n```js\nawait client.send({\n  '@type': 'sendMessage',\n  'chat_id': -123456789,\n  'input_message_content': {\n    '@type': 'inputMessageText',\n    'text': {\n      '@type': 'formattedText',\n      'text': '👻',\n    },\n  },\n})\n```\n\n## License\n\nApache License Version 2.0, January 2004\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farpit2438735%2Fnativescript-tglib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farpit2438735%2Fnativescript-tglib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farpit2438735%2Fnativescript-tglib/lists"}