Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

plaintl

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plaintl

A plain telegram listener

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

PlainTL

A plain telegram listener based on GramJS

Installation

# npm
npm i plaintl

# yarn
yarn add plaintl
// esm
import { startSession, eventEmitter } from "plaintl"

// cjs
const { startSession, eventEmitter } = require("plaintl")

Usage

Listen to Requires events and then submit your values with emitter functions. (only for the first session)

eventEmitter
    .on("RequiresPhoneNumber", (phoneNumberEmitter) => {
        phoneNumberEmitter("+989990009999")
    })
    .on("RequiresPhoneCode", (phoneCodeEmitter) => {
        phoneCodeEmitter("550055")
    })
    .on("RequiresPassword", (passwordEmitter) => {
        passwordEmitter("password")
    })
    .on("RequiresFirstAndLastNames", (firstAndLastNamesEmitter) => {
        firstAndLastNamesEmitter("firstname", "lastname")
    })

Preparing provider parameters.

Obtain apiId and apiHash from here.

For receive phone code via SMS set apiForceSMS to true.

For loggerLevel, one can select between error , warn , info , debug or none.

const providerParameters = {
    /* required */
    apiId: "your-api-id",
    apiHash: "your-api-hash",

    /* optional */
    apiForceSMS: false,
    loggerLevel: "info",
}

Start PlainTL session.

// async
await startSession(providerParameters)

// sync
startSession(providerParameters).then(() => {
    // eventEmitter
})

Listen to Telegram Update events.

eventEmitter.on("UpdateShortMessage", (event) => {
    console.log(event)
})

Cli

# npm
npx plaintl

# github
npx github:dalirnet/plaintl

Update events

Keywords

FAQs

Package last updated on 16 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc