-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (27 loc) · 1.03 KB
/
main.py
File metadata and controls
36 lines (27 loc) · 1.03 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
33
import os
import logging
import handlers as hl
import services as s
import threading
from dotenv import load_dotenv
from telegram.ext import filters, ApplicationBuilder, CommandHandler, MessageHandler
load_dotenv()
telegram_api = os.getenv("TELEGRAM_API")
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
if __name__ == '__main__':
f_stop = threading.Event()
# start calling refreshTable every 30 sec
s.refreshTable(f_stop)
application = ApplicationBuilder().token(telegram_api).build()
start_handler = CommandHandler('start', hl.start)
parking_handler = CommandHandler('slobodna_mesta', hl.freeSlots)
text_handler = MessageHandler(filters.TEXT & (~filters.COMMAND), hl.start)
location_handler = MessageHandler(filters.LOCATION, hl.location)
application.add_handler(location_handler)
application.add_handler(start_handler)
application.add_handler(text_handler)
application.add_handler(parking_handler)
application.run_polling()