266 lines
3.0 KiB
Markdown
266 lines
3.0 KiB
Markdown
# Telegram Thumbnail Upload Bot
|
|
|
|
Bot ini untuk **upload video ke Telegram bersama thumbnail secara automatik**.
|
|
|
|
---
|
|
|
|
## Keperluan
|
|
|
|
Pastikan komputer sudah install:
|
|
|
|
Disarankan guna Python **3.12 atau 3.13**
|
|
|
|
Python 3.13
|
|
https://www.python.org/downloads/release/python-3130/
|
|
|
|
Python 3.12
|
|
https://www.python.org/downloads/release/python-3120/
|
|
|
|
**FFmpeg**
|
|
https://ffmpeg.org/download.html
|
|
|
|
### Add FFmpeg to PATH (Windows)
|
|
|
|
Selepas download dan extract FFmpeg, pastikan folder `bin` dimasukkan ke dalam **System PATH**.
|
|
|
|
Contoh lokasi:
|
|
|
|
```
|
|
C:\ffmpeg\bin
|
|
```
|
|
|
|
Kalau folder ini tidak dimasukkan ke PATH, command `ffmpeg` dan `ffprobe` tidak akan dikenali oleh sistem.
|
|
|
|
Lepas install, cuba test:
|
|
|
|
```
|
|
ffmpeg -version
|
|
ffprobe -version
|
|
```
|
|
|
|
Kalau keluar version info maksudnya sudah OK.
|
|
|
|
---
|
|
|
|
## Setup Telegram API
|
|
|
|
Pergi ke:
|
|
|
|
https://my.telegram.org
|
|
|
|
Login Telegram → masuk **API development tools**
|
|
|
|
Ambil:
|
|
|
|
```
|
|
API_ID
|
|
API_HASH
|
|
```
|
|
|
|
---
|
|
|
|
## Buat Bot
|
|
|
|
Pergi ke:
|
|
|
|
https://t.me/BotFather
|
|
|
|
Run command:
|
|
|
|
```
|
|
/newbot
|
|
```
|
|
|
|
Lepas siap BotFather akan bagi:
|
|
|
|
```
|
|
BOT_TOKEN
|
|
```
|
|
|
|
---
|
|
|
|
## Setup `.env`
|
|
|
|
Dalam folder bot ada file:
|
|
|
|
```
|
|
.env.example
|
|
```
|
|
|
|
Rename jadi:
|
|
|
|
```
|
|
.env
|
|
```
|
|
|
|
Lepas tu isi macam ni:
|
|
|
|
```
|
|
BOT_TOKEN=
|
|
API_ID=
|
|
API_HASH=
|
|
```
|
|
|
|
Contoh:
|
|
|
|
```
|
|
BOT_TOKEN=123456:ABCDEF
|
|
API_ID=123456
|
|
API_HASH=abcdef1234567890
|
|
```
|
|
|
|
Jangan share file `.env` ni dengan orang lain.
|
|
|
|
---
|
|
|
|
## Jalankan Bot
|
|
|
|
Double click:
|
|
|
|
```
|
|
Start.bat
|
|
```
|
|
|
|
Script ni akan:
|
|
|
|
- create virtual environment
|
|
- install dependency
|
|
- start bot
|
|
|
|
Kalau berjaya akan nampak:
|
|
|
|
```
|
|
Bot started successfully
|
|
```
|
|
|
|
Selepas bot berjalan, buka Telegram dan cuba command berikut untuk test:
|
|
|
|
```
|
|
/send_video
|
|
```
|
|
|
|
atau
|
|
|
|
```
|
|
/batch
|
|
```
|
|
|
|
Bot akan menggunakan sample file yang sudah disediakan dalam folder:
|
|
|
|
```
|
|
single/
|
|
batch/
|
|
```
|
|
|
|
## Test Bot (Sample Files)
|
|
|
|
Repository ini sudah menyediakan **sample video dan thumbnail** supaya anda boleh terus test bot.
|
|
|
|
---
|
|
|
|
## Upload Video (Single)
|
|
|
|
Letak video dalam folder:
|
|
|
|
```
|
|
single/
|
|
```
|
|
|
|
Contoh:
|
|
|
|
```
|
|
single/
|
|
sample_video.mp4
|
|
sample_video.jpg
|
|
```
|
|
|
|
Kemudian dalam Telegram hantar command:
|
|
|
|
```
|
|
/send_video
|
|
```
|
|
|
|
Bot akan upload semua video dalam folder tu.
|
|
|
|
Pastikan **nama thumbnail sama dengan nama video**.
|
|
|
|
Contoh:
|
|
|
|
```
|
|
sample_video.mp4
|
|
sample_video.jpg
|
|
```
|
|
|
|
---
|
|
|
|
## Upload Drama (Batch)
|
|
|
|
Struktur folder:
|
|
|
|
```
|
|
batch/
|
|
|
|
drama1/
|
|
sample_video.mp4
|
|
sample_video.jpg
|
|
```
|
|
|
|
Dalam Telegram run:
|
|
|
|
```
|
|
/batch
|
|
```
|
|
|
|
Bot akan upload semua video dalam setiap folder batch.
|
|
|
|
---
|
|
|
|
## Nota
|
|
|
|
Kali pertama bot run dia akan minta:
|
|
|
|
```
|
|
Phone number
|
|
OTP code
|
|
```
|
|
|
|
Ini untuk create **user session** supaya boleh upload video besar.
|
|
|
|
Session akan disimpan dalam folder:
|
|
|
|
```
|
|
sessions/
|
|
```
|
|
|
|
---
|
|
|
|
## Converter (Optional)
|
|
|
|
Dalam folder `converter` ada tool kecil untuk convert image ke JPG kalau thumbnail format pelik macam:
|
|
|
|
```
|
|
AVIF
|
|
WEBP
|
|
HEIC
|
|
PNG
|
|
```
|
|
|
|
Run saja:
|
|
|
|
```
|
|
converter/Start.bat
|
|
```
|
|
|
|
atau
|
|
|
|
```
|
|
python converter/converter.py
|
|
```
|
|
|
|
Letakkan image dalam folder `converter/` dan hasil convert akan disimpan dalam folder `output_images/`.
|
|
|
|
---
|
|
|
|
## Siap
|
|
|
|
Lepas setup semua ni, bot dah boleh guna untuk upload video ke Telegram dengan senang. |