npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tgsnake/core

v1.12.0

Published

Pure Telegram MTProto framework for nodejs

Downloads

331

Readme

tgsnake core


Pure Telegram MTProto framework for Javascript or Typescript.

⚡ Using less dependencies to make it fast.
🔓 Open Source, you can contribute to make this framework better.
🗒️ Using Pure Telegram Raw Api, all JSON object is pure from telegram, nothing has changed at all. So that it makes it easier for you to learn the telegram schema docs.
🦕 Deno Support.

Example use

import { Client, Raw, Storages } from '@tgsnake/core';
process.env.LOGLEVEL = 'debug'; // set log level, see @tgsnake/log for more information.
const client = new Client(
  // you can fill with Telethon or Pyrogram string session.
  new Storages.StringSession(''),
  apiHash,
  apiId,
);
// handle update
client.addHandler((update) => {
  console.log(update);
});

// if you already pass the string session, don't fill any arguments in start function, leave it empty.
client.start({
  botToken: '', // if you want login as bot, you can login as user too.
  /* Remove "botToken" if you want to login as user.
  phoneNumber : async () => {}, // Phone number with international phone code (include plus sign (+)) will be used to login, the return of function must be a string.
  code : async () => {}, // OTP code, the return of function must be a string.
  password : async () => {}, // if you account has 2FA, the return of function must be a string.
  authError : async (error) => {} // when error BadRequest attempt, this function will be running.
  */
});

Exporting Session.

For exporting string session, use client.exportSession(). It will be return Promise<string>.

const exported = await client.exportSession();

Development Guidelines

  • Cloning Repository
$ git clone https://github.com/tgsnake/core
  • Installing Dependencies

Required to use yarn!

$ yarn install
  • Building TLSchema and Error class
$ yarn build:api
$ yarn build:error
  • Testing your app! Create test folder and you can create index.js file for testing the app. This folder will automatically ignored and not pushing to GitHub.

Notes

  • This framework is porting of pyrogram for connecting to telegram server. I have dedicated 2 months of my time to complete this framework from scratch. Research after research I do to improve this framework. So big thanks for pyrogram for the source, without that source code, this framework maybe unavailable.
  • For more questions, ask on telegram group (@tgsnake) or open github issue.

MIT License

Build with ♥️ by tgsnake dev.