diff --git a/aiotg/bot.py b/aiotg/bot.py index ea99b94..4fc120f 100644 --- a/aiotg/bot.py +++ b/aiotg/bot.py @@ -525,19 +525,14 @@ async def _track(self, message, name): await response.release() def _process_message(self, message): - logger.debug("_process_message %s", message) chat = Chat.from_message(self, message) - logger.debug("chat is group? %s", chat.is_group()) for mt in MESSAGE_TYPES: - logger.debug("mt %s", mt) if mt in message: - logger.debug("mt in message %s", message) self.track(message, mt) return self._handlers[mt](chat, message[mt]) if "text" not in message: - logger.debug("no text in message %s", message) return for patterns, handler in self._commands: @@ -593,9 +588,7 @@ def _process_update(self, update): # Determine update type starting with message updates for ut in MESSAGE_UPDATES: - logger.debug("ut %s", ut) if ut in update: - logger.debug("ut in update %s", update) coro = self._process_message(update[ut]) break else: diff --git a/bot/bot.py b/bot/bot.py index 12a470d..d97af20 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -146,5 +146,14 @@ async def left_chat_member_event(chat, member): @bot.group_message -async def get_group_messages(chat, message): - logger.info('Got message from group %s', message) +async def group_message_event(chat, message): + sender = message.get('from') + sender_id = sender.get('id') # noqa + sender_name = sender.get('first_name') + chat = message.get('chat') + group_id = chat.get('id') + message_date = message.get('date') + message_text = message.get('text') + logger.info('Got message from group %s at %s', (group_id, message_date)) + logger.info('Sender %s', (sender_name)) + logger.info('Text ->', message_text)