A Telegram bot designed to collect and store messages from Amharic Telegram channels into a MongoDB database. This bot is specifically built to create datasets for Amharic language processing, research, and analysis purposes.
# Telegram Dataset Collector Bot
A Telegram bot designed to collect and store messages from Amharic Telegram channels into a MongoDB database. This bot is specifically built to create datasets for Amharic language processing, research, and analysis purposes.
## Features
- π€ Automated message collection from Amharic Telegram channels
- π Stores messages in MongoDB for easy access and analysis
- π Real-time updates through long polling
- π± Supports both historical message extraction and new message collection
- π Secure authentication with Telegram and MongoDB
- π Focused on Amharic language content
## Prerequisites
- Python 3.8 or higher
- MongoDB Atlas account
- Telegram API credentials
- Active Telegram account
## Installation
1. Clone the repository:
```bash
git clone
github.com
cd Dataset_Collector_bot
```
2. Create and activate virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
4. Create a `.env` file in the root directory with your credentials:
```env
TELEGRAM_BOT_TOKEN=your_bot_token
TG_API_ID=your_api_id
TG_API_HASH=your_api_hash
PHONE=your_phone_number
MONGODB_URI=your_mongodb_uri
```
## Configuration
### Telegram Setup
1. Get your Telegram API credentials:
- Visit
my.telegram.org
- Create a new application
- Note down the `api_id` and `api_hash`
2. Create a Telegram bot:
- Talk to @BotFather on Telegram
- Create a new bot and get the bot token
### MongoDB Setup
1. Create a MongoDB Atlas account
2. Create a new cluster
3. Set up database access (username and password)
4. Whitelist your IP address
5. Get your MongoDB connection string
## Usage
1. Start the bot:
```bash
python src/main.py
```
2. The bot will:
- Connect to MongoDB
- Authenticate with Telegram
- Start collecting messages from specified Amharic channels
- Listen for new messages in real-t β¦