Thumbnail

Wednesday, March 13, 2024

Our Jurney: Introducing The Next Gen

Posted by

avatar

Ice Bear

butthx

Hi! Long time no see. Finally, tgsnake version 3 or tgsnake wayang kulit is now officially released. In this version we bring a complete overhaul of the tgsnake v2 code base.

Philosophy

Due to many bugs in tgsnake v2 and some inefficient code, we decided to completely overhaul our entire code base. We make supporting components starting from zero, we want the components we make to make maintenance easier for us and not depend on 3rd party components. Apart from that, we want to make the size of this package smaller than v2.

What major update

Uses our core framework

In v2 we use telegram or GramJS as a bridge connecting to the Telegram server.

In this update, we dropped support for gramjs and we use @tgsnake/core as a bridge that connects us to the Telegram server.

With this change, we hope to increase the efficiency of the framework and make maintenance easier for us.
With this update, we officially introduce @tgsnake/core to the public even though the framework was released some time ago.

Apart from that, in v3 we use framework components that we maintain ourselves, including:

  • @tgsnake/core
  • @tgsnake/log
  • @tgsnake/parser
  • @tgsnake/fileid

The components above are supporting components of v3, apart from that we introduced @tgsnake/redis-session for your login session, Information about your login activity and cache will be stored in Redis using this framework. By default, this framework is not installed automatically, so you have to install it manually.

Create app

In this update we make it easier for users to install, we created the create-tgsnake-app framework which can make it easier for users in the installation process like create-react-app.
We will automatically set up the configuration regarding your project so you can use it straight away.

Another, with us dropped support for gramjs. Mobile users who don't have a PC can install tgsnake without needing to install python like in v2.

Refactoring update

In this update we try to simplify updates like a fire bot, so that users who have just switched to MTProto can easily adapt.
Although we have fixed this in v2, in v3 we simplify the logic of update processing so that we get efficiency and perfect updates from Telegram.

Pluginable

In this update, we support the creation and application of plugins. With this, we hope that many people will create plugins for tgsnake that can improve quality and performance.
For more information about the plugin, you can read the documentation about the plugin here.

Deno support

In the future, we will try to make this framework multi-platform. For this update, tgsnake supports nodejs, bun, and deno platforms natively.
We do not yet support browser platforms natively.

Above are some of the major changes that have occurred to our framework. Apart from that, we also changed our logo to make it look minimalist and modern. In this update, we bring a philosophy of simplicity and modernization.

Migration Guide

Please note, in migrating to v3 you must completely rewrite your code base. With this update, tgsnake v2 officially no longer gets updates. We will focus on the development of tgsnake v3.

Before updating tgsnake in your project, make sure you have exported your login session into string-session otherwise you will need to log in again.

npm i tgsnake@latest

After you install the latest version, you need to adjust your config file to the latest config file scheme. For the schema, you can read the documentation about config file.
Additionally, you need to adjust some of your code as in the update handle which is now different from v2, learn more.

Maybe this is all I can say in this short introduction. If there is something you don't understand, you can ask us via the chat group that we have.

Thank you for choosing tgsnake.