-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
53 lines (43 loc) · 1.78 KB
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from telethon import TelegramClient, events
import asyncio
# API kimlik bilgilerinizi buraya yazın
api_id = '26272526'
api_hash = '3bc52a566e33552e1df0cab7a904f6bd'
phone_number = '+905346254881'
# Her bir saatlik mesaj
hourly_message = (
"💗 KENDİME AİT YERİM YOK 💗\n\n"
"🔥SEVGİLİ TADINDA GÖRÜŞÜYORUM 🔥\n\n"
"🏠 EVE. OTELE. APARTA REZiDANS. GELiYORUM\n\n"
"💸 ÜCRET ELDEN\n\n"
"❗️ÖNDEN ÖDEME YOK\n\n"
"Sevgili Tadinda Guven Ve Kalite Ön Planda"
)
# Gönderilecek fotoğrafın yolu
photo_path = 'fotograf.jpg'
# Grupların kullanıcı adlarını `gruplar.txt` dosyasından oku
with open('gruplar.txt', 'r') as file:
group_usernames = [line.strip() for line in file.readlines()]
async def send_hourly_message(client):
while True:
print("Belirtilen gruplara mesaj gönderiliyor...")
for group_username in group_usernames:
try:
entity = await client.get_entity(group_username)
await client.send_message(entity, hourly_message)
await client.send_file(entity, photo_path, caption=hourly_message)
print(f"{group_username} grubuna mesaj ve fotoğraf gönderildi.")
except Exception as e:
print(f"{group_username} grubuna mesaj ve fotoğraf gönderilemedi: {e}")
await asyncio.sleep(3600) # 1 saat bekle
async def main():
# TelegramClient'i başlatma
client = TelegramClient('session_name', api_id, api_hash)
# Giriş yapma
await client.start(phone_number)
# Saatlik mesajları göndermek için arka plan görevini başlatma
asyncio.create_task(send_hourly_message(client))
print("Bot çalışıyor...")
await client.run_until_disconnected()
if __name__ == '__main__':
asyncio.run(main())