Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

telegram-bot-api-lightweight-client

lightweight-clients37MITdeprecated9.1.1TypeScript support: included

The package has been moved to a new scope. Use @lightweight-clients/telegram-bot-api-lightweight-client instead.

Lightweight Telegram Bot API client. Exports only minimal Fetch call. Fully compatible with AWS LLRT.

telegram, telegram bot, telegram bot api, bot, fetch, llrt, async, lightweight, no-deps, tree-shakeable, esm

readme

Telegram Bot

NPM Version Dynamic JSON Badge NPM Downloads GitHub License

This is lightweight client for Telegram Bot API. It contains only methods and types and exports only fetch call to make requests.

It supports only application/json content type and does not support file uploads. However, you can use the corresponding methods to upload files by URLs or file IDs. You can also upload files using another approach and pass the file ID to the method.

Installation

npm install telegram-bot-api-lightweight-client

Usage

To use this library, you need to set token first. You can do it by calling setToken function.

There are also ability to set custom endpoint if you need to use local server or proxy. You also can set custom fetch function if you need to use custom request library.

Basically, all methods are named as in Telegram Bot API documentation. You can find all methods in 'client.ts' file. The only new methods are:

  • client_setClientToken(token: string): sets token for all requests.
  • client_setBaseUrl(endpoint: string): sets endpoint for all requests.
  • client_setFetch(customFetch: typeof client_fetch): sets fetch function for all requests.

Here is an example of usage:

import { setToken, getMe } from 'telegram-bot-api-lightweight-client';

setToken('hello:world');

const main = async () => {
    const me = await getMe();
    console.log(me);
};

main();

Features

  • No dependencies.
  • When using code minifiers, only the fetch command is exported.
  • Can be used in browser and Node.js.
  • Fully compatible with AWS LLRT.
  • Fully typed API.

Versioning

The versioning of this library is based on Telegram Bot API versioning. So, if Telegram Bot API version is 7.5, then this library version will be 7.5.0. The last number is for bug fixes and small changes in the library.

License

This project is licensed under the MIT License - see the LICENSE.md file for details. Types are generated from Telegram Bot API documentation. by @hey-api/openapi-ts.

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

9.1.1

Regenerated the package using the new version of the generator.

How to upgrade

  • No action required.

Details

  • The package now has a new version of the generator.
  • The new version uses typed imports.
  • The types.ts file saves as is, without any changes (except for formatting).
  • Customized types are now exported from the simple-types module.
  • Content of the simple-types module is now exported from the main module.
  • Simple-types module preserves the same naming convention as before.
  • GitHub Actions workflow now uses schemas from the lightweight-clients/schemas project.

9.1.0

Initial release of the new version 9.1.0.

9.0.1

How to upgrade

  • No action required.

Changes

  1. The package now has compiled JavaScript files instead of TypeScript files.

9.0.0

Initial release of the new version 9.0.0.

8.3.0

Initial release of the new version 8.3.0.

8.2.0

Initial release of the new version 8.2.0.

8.1.0

Initial release of the new version 8.1.0.

8.0.0

Initial release of the new version 8.0.0.

7.11.4

How to upgrade

  • No action required.

Changes

  • All files were prettified.

7.11.3

How to upgrade

  • Delete paths from import statements in your code. For example, change import { ... } from 'telegram-bot-api-lightweight-client/types' to import { ... } from 'telegram-bot-api-lightweight-client'.

7.11.0

Initial release of the new version 7.11.

7.10.0

Initial release of the new version 7.10.

7.9.0

Initial release of the new version 7.9.

7.8.0

Initial release of the new version 7.8.

7.7.0

Initial release of the new version 7.7.

7.6.0

Initial release of the new version 7.6.

7.5.0

Initial release of the new version 7.5.