-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcard.py
More file actions
32 lines (27 loc) · 1.39 KB
/
Copy pathcard.py
File metadata and controls
32 lines (27 loc) · 1.39 KB
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
from .. import loader, utils
import asyncio
@loader.tds
class AutoCardPhoneGet(loader.Module):
"""Модуль для автоматической отправки 'ткарточка' в чат каждые 3 часа"""
strings = {
"name": "AutoCardPhoneGet",
"status": "Модуль отправляет 'ткарточка' в чат phonegettalk каждые 3 часа."
}
async def client_ready(self, client, db):
"""Инициализация модуля при старте клиента"""
self.client = client
self.chat_id = -1002735741409 # ID чата
asyncio.create_task(self.auto_send())
async def auto_send(self):
"""Отправляет сообщение 'ткарточка' каждые 3 часа"""
while True:
try:
await self.client.send_message(self.chat_id, "ткарточка")
await asyncio.sleep(3 * 60 * 60) # Ожидание 3 часов (10800 секунд)
except Exception as e:
print(f"AutoCardPhoneGet: Ошибка при отправке: {e}")
await asyncio.sleep(60) # Пауза 1 минута при ошибке
@loader.command()
async def cardstatus(self, message):
"""Проверяет статус модуля"""
await utils.answer(message, self.strings["status"])