INNER CODE UNIT · Python

stop

MrMKN/PROFESSOR-BOT · bot.py:57

    async def stop(self, *args):
        await super().stop()
        logging.info(f"Bot Is Restarting ⟳...")

    async def iter_messages(self, chat_id: Union[int, str], limit: int, offset: int = 0) -> Optional[AsyncGenerator["types.Message", None]]:                       
        current = offset
        while True:
            new_diff = min(200, limit - current)
            if new_diff <= 0:
                return
            messages = await self.get_messages(chat_id, list(range(current, current+new_diff+1)))
            for message in messages:
                yield message
                current += 1


        
Bot().run()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…