# nestjs-telegram

> A NestJS Module for Telegram Bots

Latest version **1.2.0** (published 2022-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install nestjs-telegram
pnpm add nestjs-telegram
yarn add nestjs-telegram
bun add nestjs-telegram
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-03-21 |
| First published | 2019-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 65.9 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 103 |
| Author | Jay McDoniel |
| Maintainers | jmcdo29, bukhalo |
| Keywords | nest, nestjs, telegram, bot |

## Links

- npm: https://www.npmjs.com/package/nestjs-telegram
- Repository: https://github.com/jmcdo29/nestjs-telegram
- Homepage: https://github.com/jmcdo29/nestjs-telegram#readme
- Issues: https://github.com/jmcdo29/nestjs-telegram/issues
- npm.io page: https://npm.io/package/nestjs-telegram

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^6.3.3
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^6.0.0
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^6.0.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.12

## Recent versions

- 1.2.0 (latest) — 2022-03-21
- 1.1.4 — 2022-03-21
- 1.1.3 — 2021-08-05
- 1.1.2 — 2019-07-15
- 1.1.1 — 2019-07-15
- 1.1.0 — 2019-07-15
- 1.0.0 — 2019-07-15

## README

<p align="center">
  <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a><img src="https://cdn.pixabay.com/photo/2016/12/21/17/11/signe-1923369_960_720.png" alt="plus" width="100"> <a href="https://telegram.org" target="blank"><img src="https://telegram.org/img/t_logo.png" width ="140" alt="Telegram Logo"/></a>
</p>
  
  <h1 align="center">A <a href="http://nestjs.com" target="blank">NestJS</a> service wrapper for <a href="https://telegram.org" target="blank">Telegram</a> bots!
  </h1>
  <p align="center">
  <a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-purple.svg?style=flat"/></a>
  <a href="http://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg"/></a>
  <a href="https://travis-ci.org/jmcdo29/nestjs-telegram"><img src="https://travis-ci.org/jmcdo29/nestjs-telegram.svg?branch=master"/></a>
  <a href="https://coveralls.io/github/jmcdo29/nestjs-telegram?branch=master"><img src="https://coveralls.io/repos/github/jmcdo29/nestjs-telegram/badge.svg?branch=master"/></a>
  <a href="https://github.com/facebook/jest"><img src="https://img.shields.io/badge/tested_with-jest-99424f.svg"/></a>
  <a href="https://dependabot.com"><img src="https://api.dependabot.com/badges/status?host=github&repo=jmcdo29/nestjs-telegram"/></a>
  <a href="https://snyk.io/test/github/jmcdo29/nestjs-telegram?targetFile=package.json"><img src="https://snyk.io/test/github/jmcdo29/nestjs-telegram/badge.svg?targetFile=package.json"/></a>
</p>
<p align="center">
</p>

## Description

[Telegram](https://telegram.org) API wrapper for the Telegram Bots API made to work with the [Nest](https://github.com/nestjs/nest) framework.

## Installation

```bash
$ npm install nestjs-telegram
```

## Using the Module

```typescript
// Inside of your module imports
@Module({
  imports: [TelegramModule.forRoot({
    botKey: 'YourBotApiToken'
  })]
})

// Or async
@Module({
  imports: [
    TelegramModule.forRootAsync({
      useFactory: async (configService: ConfigService) => ({
        botKey: configService.get('Telegram_API_Key')
      }),
      inject: [ConfigService]
    })
  ],
})
```

In your service class you can inject the service like so and then use it in any function as you would any other service
```typescript
@Injectable()
export class MyService {

  constructor(private readonly telegram: TelegramService) {}

  testBot(): Observable<TelegramUser> {
    return this.telegram.getMe();
  }
}
```

Currently, the service only returns `Observables` as the `HttpModule` does. If you want to use `Promises` just call `.toPromise()` on the function.

## Support

If any bugs are found in the API wrapper, please open an issue on GitHub, or a Pull Request if you want to fix it yourself! Please be as explicit as possible and provide a minimum reproducing repository if at all possible, as it helps track down what went wrong.

## Documentation

All documentation for this wrapper comes from the [Telegram Bot API documentation](https://core.telegram.org/bots/api), if there are any typos, please let me know or open a PR to fix it.

## Todo

* Implement Telegram Passport methods
* Implement Telegram Inline mode options

## Stay in touch

- Author - [Jay McDoniel](https://github.com/jmcdo29)

## License

Nestjs-telegram is [MIT licensed](LICENSE).

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