diff --git a/userge/core/client.py b/userge/core/client.py index a2558735f..f27f10c7e 100644 --- a/userge/core/client.py +++ b/userge/core/client.py @@ -235,7 +235,6 @@ async def stop(self) -> None: # pylint: disable=arguments-differ _LOG.info(_LOG_STR, "Stopping Userge") await super().stop() await _set_running(False) - pool._stop() # pylint: disable=protected-access def begin(self, coro: Optional[Awaitable[Any]] = None) -> None: """ start userge """ @@ -255,8 +254,6 @@ async def _finalize() -> None: t.cancel() if self.is_initialized: await self.stop() - else: - pool._stop() # pylint: disable=protected-access # pylint: disable=expression-not-assigned [t.cancel() for t in asyncio.all_tasks() if t is not asyncio.current_task()] await self.loop.shutdown_asyncgens() @@ -282,6 +279,7 @@ def _close_loop() -> None: pass self.loop.close() _LOG.info(_LOG_STR, "Loop Closed !") + pool._stop() # pylint: disable=protected-access try: self.loop.run_until_complete(self.start()) diff --git a/userge/plugins/tools/ping.py b/userge/plugins/tools/ping.py index 1eeb4b719..bd1ff0b24 100644 --- a/userge/plugins/tools/ping.py +++ b/userge/plugins/tools/ping.py @@ -8,6 +8,8 @@ from datetime import datetime +from pyrogram.raw.functions import Ping + from userge import userge, Message @@ -16,7 +18,7 @@ 'flags': {'-a': "average ping"}}, group=-1) async def pingme(message: Message): start = datetime.now() - await message.edit('`Pong!`') + await message.client.send(Ping(ping_id=0)) end = datetime.now() m_s = (end - start).microseconds / 1000 await message.edit(f"**Pong!**\n`{m_s} ms`")