Skip to content

Instantly share code, notes, and snippets.

@spiritbroski
Created July 13, 2020 00:52
Show Gist options
  • Save spiritbroski/9c4d19f2736ae051d0cf2667128a94b8 to your computer and use it in GitHub Desktop.
Save spiritbroski/9c4d19f2736ae051d0cf2667128a94b8 to your computer and use it in GitHub Desktop.
import { Injectable,OnModuleInit } from '@nestjs/common';
import { TelegramLib } from '../../lib/telegram';
@Injectable()
export class TelegramService implements OnModuleInit{
constructor(
private telegramLib:TelegramLib
) {}
onModuleInit() {
console.log(`Initialization... telegram`);
this.telegramLib.bot.on('text', (ctx) => {
console.log(ctx.update.message.from.id)
ctx.reply("id "+ctx.update.message.from.id+" username "+ctx.update.message.from.username)
})
this.telegramLib.bot.launch()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment