# telegram-bot-ts-types

> Typescript classes for telegram (https://core.telegram.org/bots/api)

Latest version **1.4.0** (published 2020-04-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install telegram-bot-ts-types
pnpm add telegram-bot-ts-types
yarn add telegram-bot-ts-types
bun add telegram-bot-ts-types
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-04-17 |
| First published | 2020-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 601.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | le-ar |
| Maintainers | le-ar |
| Keywords | json, serialize, telegram, bot, typescript, ts, generator, types, telegram-types, typescript-types, telegram-typescript, telegram-typescript-types, telegram-bot-ts-types |

## Links

- npm: https://www.npmjs.com/package/telegram-bot-ts-types
- Repository: https://github.com/le-ar/telegram-bot-ts-types
- npm.io page: https://npm.io/package/telegram-bot-ts-types

## Dependencies (1)

- [formdata-node](https://npm.io/package/formdata-node.md) ^2.1.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.4.0 (latest) — 2020-04-17
- 1.3.4 — 2020-04-16
- 1.3.4-mp — 2020-04-16
- 1.3.3 — 2020-04-16
- 1.3.2-mp — 2020-04-16
- 1.3.2 — 2020-04-16
- 1.3.1-mp — 2020-04-16
- 1.3.1 — 2020-04-16
- 1.3.0-mp — 2020-04-16
- 1.3.0 — 2020-04-16
- 1.2.2 — 2020-04-16
- 1.2.1 — 2020-04-13
- 1.2.0 — 2020-04-13
- 1.1.1 — 2020-04-13
- 1.1.0 — 2020-04-13
- … 1 more at https://npm.io/package/telegram-bot-ts-types/versions

## README

<h1 align="center">Telegram Types</h1>

<div align="center">

Full Typescript classes for [Telegram bot api](https://core.telegram.org/bots/api)

With serialization to and from json. With serialization to FormData. Only one dependency.

Auto generated by [telegram-types-generator](https://www.npmjs.com/package/telegram-types-generator)

![David](https://img.shields.io/david/le-ar/telegram-bot-ts-types)
![NPM](https://img.shields.io/npm/l/telegram-bot-ts-types)
[![npm](https://img.shields.io/npm/dw/telegram-bot-ts-types)](https://www.npmjs.com/package/telegram-bot-ts-types)
![GitHub top language](https://img.shields.io/github/languages/top/le-ar/telegram-bot-ts-types)
[![CodeFactor](https://www.codefactor.io/repository/github/le-ar/telegram-bot-ts-types/badge)](https://www.codefactor.io/repository/github/le-ar/telegram-bot-ts-types)
[![Bot API](https://img.shields.io/badge/Bot%20API-latest-00aced.svg?&logo=telegram)](https://core.telegram.org/bots/api)

[![patreon](https://img.shields.io/endpoint?url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Fle_ar%2Fendel)](https://www.patreon.com/le_ar)
[![Liberapay giving](https://img.shields.io/liberapay/receives/le-ar)](https://liberapay.com/le-ar/donate)

</div>

## Install
```
npm install telegram-bot-ts-types
```
or
```
yarn add telegram-bot-ts-types
```

## Usage

```typescript
import { User } from 'telegram-bot-ts-types';

new User({
    id: 0,
    isBot: false,
    firstName: 'firstName'
});
```

## Example Serializer

```typescript
import { ChatSerializer, Chat } from "telegram-bot-ts-types";

let json = '{"id":123,"type":"private","username":"username","first_name":"Name"}';

let chat = ChatSerializer.fromJson(JSON.parse(json));

console.log(chat); /* Will print
Chat {
  _id: 123,
  _type: 'private',
  _title: null,
  _username: 'username',
  _firstName: 'Name',
  _lastName: null,
  _photo: null,
  _description: null,
  _inviteLink: null,
  _pinnedMessage: null,
  _permissions: null,
  _slowModeDelay: null,
  _stickerSetName: null,
  _canSetStickerSet: null
}*/

console.log(chat instanceof Chat); // Will print true

let jsonChat = ChatSerializer.toJsonString(chat);
console.log(jsonChat); // Will print {"id":123,"type":"private","username":"username","first_name":"Name"}
```

---
_Source: https://npm.io/package/telegram-bot-ts-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
