Selamlar,
Telegram botumun ekli olduğu bütün grupları nasıl görebilirim öyle bi seçeneğim var mı ?
O gruplara duyuru gönderebilir miyim. Yardımcı olabilecek var mı
Telegram botuyla alakalı soru
7
●160
- 01-04-2025, 18:24:51Merhaba öyle birşey mümkün değil ekli olan grupları göremezsiniz sadece kendiniz veri tabanı oluşturabilirsiniz.
- 01-04-2025, 19:35:02srhtyldz adlı üyeden alıntı: mesajı görüntüle
- 01-04-2025, 19:36:49MeXe adlı üyeden alıntı: mesajı görüntüle
- 01-04-2025, 19:44:23srhtyldz adlı üyeden alıntı: mesajı görüntüle
- 01-04-2025, 22:05:25ChatGPT ile şöyle bi bot oluşturduk, bence işe yarar gibi. Lazım olan kullanabilir
import requests import time BOT_TOKEN = 'YOUR_BOT_TOKEN_HERE' GET_UPDATES_URL = f'https://api.telegram.org/bot{BOT_TOKEN}/getUpdates' OFFSET_FILE = 'offset.txt' GROUPS_FILE = 'groups.txt' def get_last_offset(): try: with open(OFFSET_FILE, 'r') as f: return int(f.read().strip()) except: return 0 def save_offset(offset): with open(OFFSET_FILE, 'w') as f: f.write(str(offset)) def save_group_id(chat_id, title): try: with open(GROUPS_FILE, 'r') as f: lines = f.readlines() if str(chat_id) in [line.strip() for line in lines]: return # zaten kayıtlı except: pass with open(GROUPS_FILE, 'a') as f: f.write(f"{chat_id} # {title}n") print(f"[+] Yeni grup bulundu: {title} ({chat_id})") def main(): while True: offset = get_last_offset() try: res = requests.get(GET_UPDATES_URL, params={'offset': offset + 1, 'timeout': 10}) data = res.json() if not data.get('ok'): print("Hatalı yanıt:", data) time.sleep(5) continue for update in data['result']: offset = update['update_id'] message = update.get('message') or update.get('edited_message') if not message: continue chat = message['chat'] chat_type = chat.get('type') if chat_type in ['group', 'supergroup']: save_group_id(chat['id'], chat.get('title', 'İsimsiz Grup')) save_offset(offset) except Exception as e: print("Hata:", str(e)) time.sleep(5) # 5 saniyede bir kontrol et if __name__ == '__main__': main()