PlainTL
A plain telegram listener based on GramJS
Installation
npm i plaintl
yarn add plaintl
import { startSession, eventEmitter } from "plaintl"
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 forceSMS
to true.
For logLevel
, one can select between error , warn , info , debug or none.
const providerParameters = {
apiId: "your-api-id",
apiHash: "your-api-hash",
forceSMS: false,
logLevel: "info",
}
Start PlainTL
session.
const client = await startSession(providerParameters)
startSession(providerParameters).then((client) => {
})
Listen to Telegram
Update events.
eventEmitter.on("UpdateShortMessage", (event) => {
console.log(event)
})
Cli
npx plaintl
npx github:dalirnet/plaintl
Limitation
Update events