@telelib/telelib
v6.0.11
Published
A NodeJS Telegram API Wrapper.
Downloads
3
Maintainers
Readme
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()
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 - [email protected] - 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.