mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
publish: 5.9.4
This commit is contained in:
parent
f31a4d3662
commit
a9739c1865
3 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import datetime
|
||||||
import asyncio
|
import asyncio
|
||||||
from typing import *
|
from typing import *
|
||||||
import royalnet
|
import royalnet
|
||||||
|
@ -18,6 +19,7 @@ class PingCommand(rc.Command):
|
||||||
|
|
||||||
tasks = {}
|
tasks = {}
|
||||||
|
|
||||||
|
start = datetime.datetime.now()
|
||||||
for target in self._targets:
|
for target in self._targets:
|
||||||
tasks[target] = self.loop.create_task(self.interface.call_herald_event(target, "pong"))
|
tasks[target] = self.loop.create_task(self.interface.call_herald_event(target, "pong"))
|
||||||
|
|
||||||
|
@ -27,10 +29,13 @@ class PingCommand(rc.Command):
|
||||||
|
|
||||||
for name, task in tasks.items():
|
for name, task in tasks.items():
|
||||||
try:
|
try:
|
||||||
print(task.result())
|
d = task.result()
|
||||||
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
||||||
lines.append(f"🔴 [c]{name}[/c]")
|
lines.append(f"🔴 [c]{name}[/c]")
|
||||||
else:
|
else:
|
||||||
lines.append(f"🔵 [c]{name}[/c]")
|
end = datetime.datetime.fromtimestamp(d["timestamp"])
|
||||||
|
delta = end - start
|
||||||
|
|
||||||
|
lines.append(f"🔵 [c]{name}[/c] ({delta.microseconds // 1000} ms)")
|
||||||
|
|
||||||
await data.reply("\n".join(lines))
|
await data.reply("\n".join(lines))
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
from typing import *
|
from typing import *
|
||||||
import royalnet
|
import royalnet
|
||||||
import royalnet.commands as rc
|
import royalnet.commands as rc
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class PongEvent(rc.Event):
|
class PongEvent(rc.Event):
|
||||||
name = "pong"
|
name = "pong"
|
||||||
|
|
||||||
async def run(self, **kwargs) -> dict:
|
async def run(self, **kwargs) -> dict:
|
||||||
return {"status": "connected"}
|
return {"timestamp": datetime.datetime.now().timestamp()}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
semantic = "5.9.3"
|
semantic = "5.9.4"
|
||||||
|
|
Loading…
Reference in a new issue