Queer European MD passionate about IT
Переглянути джерело

`handle_location` method deprecated

Davte 5 роки тому
батько
коміт
637dca7af2
2 змінених файлів з 7 додано та 27 видалено
  1. 1 1
      davtelepot/__init__.py
  2. 6 26
      davtelepot/custombot.py

+ 1 - 1
davtelepot/__init__.py

@@ -14,7 +14,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.1.29"
+__version__ = "2.1.30"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 6 - 26
davtelepot/custombot.py

@@ -314,32 +314,12 @@ class Bot(davtelepot.bot.Bot):
                 )
         return
 
-    async def handle_location(self, update):
-        """Handle location sent by user."""
-        user_id = update['from']['id'] if 'from' in update else None
-        answerer, answer = None, None
-        if self.maintenance:
-            if update['chat']['id'] > 0:
-                answer = self.maintenance_message
-        elif user_id in self.custom_location_parsers:
-            answerer = self.custom_location_parsers[user_id]
-            del self.custom_location_parsers[user_id]
-        if answerer:
-            if asyncio.iscoroutinefunction(answerer):
-                answer = await answerer(update)
-            else:
-                answer = answerer(update)
-        if answer:
-            try:
-                return await self.send_message(answer=answer, chat_id=update)
-            except Exception as e:
-                logging.error(
-                    "Failed to process answer:\n{}".format(
-                        e
-                    ),
-                    exc_info=True
-                )
-        return
+    async def handle_location(self, *args, **kwargs):
+        """Handle location sent by user.
+
+        This method is deprecated: use `location_message_handler` instead.
+        """
+        return await super().location_message_handler(*args, **kwargs)
 
     def set_custom_parser(self, parser, update=None, user=None):
         """Set a custom parser for the user.