chore: update version; move scripts into examples folder
This commit is contained in:
@@ -6,19 +6,17 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||
|
||||
import threading
|
||||
import time
|
||||
from itd import ITDClient, StreamConnect, StreamNotification
|
||||
from itd import ITDClient, StreamConnect
|
||||
|
||||
def main():
|
||||
cookies = 'YOUR_COOKIES_HERE'
|
||||
|
||||
cookies = 'YOUR_COOKIES_HERE'
|
||||
|
||||
if cookies == 'YOUR_COOKIES_HERE':
|
||||
print('! Укажите cookies в переменной cookies')
|
||||
return
|
||||
|
||||
|
||||
client = ITDClient(cookies=cookies)
|
||||
|
||||
# Функция для прослушивания в отдельном потоке
|
||||
|
||||
def listen():
|
||||
print('! Начинаем прослушивание...')
|
||||
try:
|
||||
@@ -29,17 +27,16 @@ def main():
|
||||
print(f'🔔 {event.type.value}: {event.actor.username}')
|
||||
except Exception as e:
|
||||
print(f'! Ошибка: {e}')
|
||||
|
||||
# В отдельном потоке
|
||||
|
||||
thread = threading.Thread(target=listen, daemon=True)
|
||||
thread.start()
|
||||
|
||||
|
||||
print('Прослушивание запущено. Нажмите Enter для остановки...')
|
||||
input()
|
||||
|
||||
|
||||
print('!! Останавливаем прослушивание...')
|
||||
client.stop_stream()
|
||||
|
||||
|
||||
thread.join(timeout=5)
|
||||
print('! Остановлено')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user