telegram-group-counter

A simple Python script to check how many Telegram groups a user is in.

WTFPL License

Stars
3

Telegram Group Counter

The Python script telegram_group_counter.py allows you to programmatically count the number of Telegram groups you're a member of using the Telegram API and the Telethon library.

Prerequisites

  • Python >=3.6
  • Telegram API credentials (api_id and api_hash)
  1. Clone this repository:
git clone https://github.com/pcaversaccio/telegram-group-counter.git
cd telegram-group-counter
  1. Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`.
  1. Install the required packages:
pip install -r requirements.txt
  1. Create a .env file in the project root and add your Telegram API credentials[^1]:
API_ID="your_api_id"
API_HASH="your_api_hash"
PHONE_NUMBER="your_phone_number"

[!CAUTION] Make sure to keep your .env file secure and never commit it to version control!

Usage

Run the script using Python:

python scripts/telegram_group_counter.py

The script will output the number of Telegram groups you're a member of 🫡.

You are in 123 Telegram groups.

[^1]: To get the Telegram API credentials go to my.telegram.org and log in with your phone number. Now click on API development tools and create a new application by filling in the required fields. Once created, you'll see your api_id (a number) and api_hash (a string).