Skip to content

beavernsticks/moleculer-telegram-bot

Repository files navigation

Moleculer logo


Telegram bot support for Moleculer microservices framework based on GrammY. NPM version


Install

$ npm install @beavernsticks/moleculer-telegram-bot --save

Usage

Add TelegramBotMixin to your service

import { TelegramBotMixin } from '@beavernsticks/moleculer-telegram-bot'

broker.createService({
  name: 'greeter',
  mixins: [TelegramBotMixin],
  settings: {
    telegram: {
      token: '<BOT TOKEN>',
    },
  },
  actions: {
    welcome: {
      handler(ctx) {
        return this.sendMessage(ctx, 'Hello!', { tgId: 12345 })
      },
    },
  },
})

Configurations

Setting fields

Property Type Default Description
token string required Bot token from @BotFather.

License

The project is available under the MIT license.

Contact

Copyright (c) 2023 Beaver'n'Sticks