Socket
Socket
Sign inDemoInstall

nest-telegram-bot

Package Overview
Dependencies
136
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nest-telegram-bot

Nest.js wrapper for node-telegram-bot-api (not full)


Version published
Maintainers
1
Install size
10.1 MB
Created

Readme

Source

Disclaimer

This wrapper around only 2 methods:

  • sendMessage
  • sendPhoto

What is it?

This package is wrapper aroud node-telegram-bot-api for Nest.js

How to use

Register module:

@Module({
    imports: [
        TelegramModule.forRootAsync({
            imports: [UtilsModule],
            inject: [ConfigService],
            useFactory(configService: ConfigService) {
                return {
                    token: configService.get("TELEGRAM_BOT_TOKEN"),
                    chat_id: configService.get("TELEGRAM_CHAT_ID")
                };
            }
        })
    ],
    controllers: [],
    providers: []
})
export class AppModule {}

Get access to service:

@Controller("api")
export class SomeController {
    public constructor(private readonly telegram_service: TelegramService) {}

    @Post("consultation")
    @UsePipes(new ValidationPipe({ transform: true }))
    public consultation(@Body() body: ConsultationOrderDto) {
        await this.telegram_service.sendMessage({
            message: "New order for consultation!..."
        });
        return "OK";
    }
}

TODO`s

  • Full support all methods of node-telegram-bot-api

FAQs

Last updated on 07 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc