gramjs-sqlitesession

1.1.1 • Public • Published

gramjs-sqlitesession

GramJS SqliteSession for working with .session files.

Note: SqliteSession does not support using inside the browser. (Node.js ONLY)

How to get started

Install gramjs-sqlitesession:

$ npm i -D gramjs-sqlitesession

Then run this code to send a message to yourself.

const {TelegramClient} = require('telegram');
const SQLiteSession = require('gramjs-sqlitesession');

const apiId = 123456;
const apiHash = "123456abcdfg";
const pathToSessionFile = "./1234567890.session";
const sqliteSession = new SQLiteSession(pathToSessionFile);

(async () => {
  console.log("Loading interactive example...");
  const client = new TelegramClient(sqliteSession, apiId, apiHash, {
    connectionRetries: 5,
  });
  await client.connect();
  await client.sendMessage("me", { message: "Hello!" });
  await client.disconnect();
})();

Note: It is not possible to create .session file for unauthorized user for now

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.130latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.130

Package Sidebar

Install

npm i gramjs-sqlitesession

Weekly Downloads

30

Version

1.1.1

License

MIT

Unpacked Size

4.24 kB

Total Files

4

Last publish

Collaborators

  • vladwwe24