@telelib/telelib
TypeScript icon, indicating that this package has built-in type declarations

6.0.11 • Public • Published

TeleLib

a node js Telegram Wrapper written in TypeScript.

installation

yarn add @telelib/telelib

or

npm i --save @telelib/telelib

how to use

create a .js or a .ts file install the package using npm or yarn

import the package:

import { Bot } from '@telelib/telelib'

create an instance:

const TelegramBot = new Bot({
 telegram: {
  token: '[TOKEN]',
 },
 debug: true
})

since it's typescript, import Types as well

import { types } from '@telelib/telelib'
  • replace [TOKEN] with your telegram bot token

create a listener on 'Message' Type:

TelegramBot.client.on(
 'message',
 (msg: types.Message) => {
  if (msg.text) {
   return msg.reply(`your message was:\n${msg.text}`)
  }
  msg.reply('i only understand text messages')
 }
)

then start the loop to fetch updates from telegram.

TelegramBot.start()
  • for more examples visit examples
  • for better and more detailed documentation visit docs

more info

issues / bugs / suggestions ?

there's no template for now, just open an issue or fix it and do a Pull request, your name will be here as a contributor. :)

contributors

Mohammad Mahdi Afshar - me@mamad.dev - Telegram - Maintainer

todo list

  • [ ] Write Full Documentation
  • [ ] add Helper methods
  • [ ] Add More examples
  • [ ] Write Interfaces for all Message types, classes, methods.
  • [ ] Add Support for Webhooks
  • [ ] Implement TelegramPassport related methods
  • [ ] Add MTProto and TDLib Wrapper.
  • [ ] Clean up and optimize the code.

Package Sidebar

Install

npm i @telelib/telelib

Weekly Downloads

2

Version

6.0.11

License

MIT

Unpacked Size

731 kB

Total Files

278

Last publish

Collaborators

  • mamad.dev