Skip to content

Commit

Permalink
live geolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Anisan committed Aug 7, 2024
1 parent dfc9751 commit 88fd31f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def cyclic_task(self):

def wrapper():
try:
self.isStarted = True
self.bot.polling(non_stop=True, long_polling_timeout=5)
except Exception as ex:
self.logger.exception(ex)
self.isStarted = False


self.isStarted = True
thread = threading.Thread(name="Thread_pooling_telegram",target=wrapper)
thread.start()
else:
Expand Down
2 changes: 2 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class TypeEvent(Enum):
Document = 6
Sticker = 7
Location = 8
Venue = 9
Contact = 10

class TypeDirection(Enum):
""" Type direction """
Expand Down
13 changes: 13 additions & 0 deletions handlers/MessageHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ def handle_sticker(message) -> None:
def handle_video(message) -> None:
self.events_work(message,TypeEvent.Video)

@self.bot.message_handler(content_types=['venue'])
def handle_venue(message) -> None:
self.events_work(message,TypeEvent.Venue)

@self.bot.message_handler(content_types=['contact'])
def handle_contact(message) -> None:
self.events_work(message,TypeEvent.Contact)

@self.bot.message_handler(content_types=['dice'])
def handle_dice(message) -> None:
self.events_work(message,TypeEvent.Dice)

@self.bot.message_handler(content_types=['location'])
@self.bot.edited_message_handler(content_types=['location'])
def handle_location(message) -> None:
self.events_work(message,TypeEvent.Location)

0 comments on commit 88fd31f

Please sign in to comment.