Skip to content

Whatsapp Bot that converts Whatsapp Stickers into Telegram Stickers.

License

Notifications You must be signed in to change notification settings

hellmrf/WhatsGram-Stickers

Repository files navigation


WhatsGramStickers Bot

Bot that easily converts WhatsApp stickers to Telegram.
Try it » (not running anymore 🙁)

Report Bug · Leia em Português

Contributors Forks Stargazers Issues MIT License LinkedIn

Table of Contents

About The Project

WhatsGramStickersBot Demonstration

Many people who migrate to Telegram, despite the huge amount of resources compared to WhatsApp, miss some stickers that are present on WhatsApp. While it's possible to create your own sticker pack on Telegram, doing so directly with WhatsApp stickers is not. With that in mind, I developed this solution that, in a simple way, allows the user to automatically create a package on Telegram with their WhatsApp stickers. As an additional feature, the created package is legitimately "owned" by the user and can be managed normally, including through the @Stickers Bot.

This project was developed only for learning. As the last bot developed by me used Node.js, I decided to use Python this time. During development, I encountered problems such as ensuring that the bot continues to respond to messages while creating the package for a user, which was solved using multithreading with Python's concurrent.futures.ThreadPoolExecutor. Deploy the project was also a challenge, since Heroku has extremely peculiar ways of working.

Built With

This project uses Python as programming language, PostgreSQL as database and are free hosted on Heroku. It also uses the following resources.


Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Make sure you have Python ≥ 3.7 and pip.

  • You can create a new virtual environment, but it's optional

$ python3 -m venv whatsgram

$ source tutorial-env/bin/activate # Unix

$ tutorial-env\Scripts\activate.bat # Windows

Beginners tip: you'll see shell commands like this: (whatsgram) $ something. In this case, type just something in your Terminal. (whatsgram) indicates the active virtual environment and $ indicates "input".

  • Install dependencies
(whatsgram) $ pip install -r requirements.txt

Installation

  1. Clone the WhatsGram-Stickers and enter the directoy
(whatsgram) $ git clone https://github.com/hellmrf/WhatsGram-Stickers.git

(whatsgram) $ cd WhatsGram-Stickers
  1. Create a credentials folder with two files: database.ini and TelegramApiKey.txt that contain your Telegram Bot token:
(whatsgram) $ mkdir credentials && cd credentials
(whatsgram) $ touch database.ini
(whatsgram) $ echo "TELEGRAM_TOKEN" > TelegramApiKey.txt

If using Windows, use Explorer and Notepad (be sure to save database.ini as "All files", not "Text file (*.txt)").

  1. database.ini will have the following content (update to match your environment):
[postgresql]
host=localhost
database=whatsgram
user=postgres
password=postgres
  1. Create the necessary tables
(whatsgram) $ python whatsgramstickers/migrate.py

Usage

Just run:

(whatsgram) $ python whatsgramstickers/main.py

First run

For the first run, you'll need to scan the QR Code on WhatsApp Web. You have 2 choices.

First choice: the simplest

When the bot try to load to Whatsapp and fail, it'll take a screenshot of the browser and save to whatsgramstickers/scrsht.png. Just open and scan!

Second choice: the most reliable

Sometimes the first method takes an useless screenshot (just the spinner, for example). In this case...

Open whatsgramstickers/main.py and, on line 14, set headless=False and run once. Chrome will open WhatsApp Web.

Log in as a normal user (make sure "keep me connected" are checked).

Go back to main.py and set headless=True back.

Limitations

The main limitations are:

  • Mobile device must be always connected to the internet.
  • Stickers are uploaded in only one thread (at most two, one per user), which makes this process extremely time-consuming (see issue #7).
  • Although the bot delete the messages when a new command are received, the stickers downloaded by mobile device continue eating space.
  • The bot doesn't respond to WhatsApp until it finishes generating a package (fixed)

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Heliton Martins - @hellmrf - helitonmrf@gmail.com

Project Link: https://github.com/hellmrf/WhatsGram-Stickers

About

Whatsapp Bot that converts Whatsapp Stickers into Telegram Stickers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published