telegram: Simplify get entity type name routine
patch 8729250774e56024723bc882c6da35402f602906
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Feb 6 17:38:26 CET 2022
* telegram: Simplify get entity type name routine
diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py
--- old-irgramd/telegram.py 2024-11-22 22:38:57.340869932 +0100
+++ new-irgramd/telegram.py 2024-11-22 22:38:57.340869932 +0100
@@ -14,7 +14,6 @@
# Constants
-TL_TYPES_IDENT = re.compile(r"<class 'telethon.tl.types.([^']+)'>")
FILENAME_INVALID_CHARS = re.compile('[/{}<>()"\'\\|&]')
# Configuration
@@ -240,7 +239,7 @@
return tid
def get_entity_type(self, entity):
- return TL_TYPES_IDENT.match(str(type(entity))).groups()[0]
+ return type(entity).__name__
async def handle_telegram_message(self, event):
self.logger.debug('Handling Telegram Message: %s', event)