rsf-telegramable
TypeScript icon, indicating that this package has built-in type declarations

1.0.84 • Public • Published

rsf-telegramable

A class that can send and receive telegram messages, that has a clean and simple speak/listen API.

Works in concert with rsf-telegram-bot.

Installation

npm install --save rsf-telegramable

Formatting of id

The id property of a person config should be like the following:

username

Associated type configuration

In a person config, use type telegram to specify a Telegramable

Telegramable Person Config Example

{
  "type": "telegram",
  "id": "myusername"
}

Usage

You must be running an instance of rsf-telegram-bot to connect to via websockets in order for the following to work. Say that is running on localhost, on port 3022...

const { init, shutdown, Telegramable } = require('rsf-telegramable')

const config = {
  socketUrl: 'ws://localhost:3022'
}
init(config).then(() => {
  const person = new Telegramable('tgusername')
  // log anything that we hear from them
  person.listen(console.log)
  person.speak('hello!')

  // after 5 seconds, shutdown/disconnect
  // person methods will no longer work, or be fired
  setTimeout(() => {
    shutdown()
  }, 5000)
})

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.842latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.842
1.0.831
1.0.821
1.0.811
1.0.81
1.0.71
1.0.61
1.0.51
1.0.41
1.0.31
1.0.21
1.0.11
1.0.01

Package Sidebar

Install

npm i rsf-telegramable

Weekly Downloads

14

Version

1.0.84

License

GPL-3.0

Unpacked Size

47.8 kB

Total Files

7

Last publish

Collaborators

  • connoropolous