mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
publish: 5.9.3
This commit is contained in:
parent
d009f63a07
commit
f31a4d3662
3 changed files with 14 additions and 33 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "royalpack"
|
name = "royalpack"
|
||||||
version = "5.9.2"
|
version = "5.9.3"
|
||||||
description = "A Royalnet command pack for the Royal Games community"
|
description = "A Royalnet command pack for the Royal Games community"
|
||||||
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
|
||||||
license = "AGPL-3.0+"
|
license = "AGPL-3.0+"
|
||||||
|
|
|
@ -11,45 +11,26 @@ class PingCommand(rc.Command):
|
||||||
|
|
||||||
syntax: str = ""
|
syntax: str = ""
|
||||||
|
|
||||||
|
_targets = ["telegram", "discord", "matrix", "constellation"]
|
||||||
|
|
||||||
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
||||||
await data.reply("📶 Ping...")
|
await data.reply("📶 Ping...")
|
||||||
|
|
||||||
telegram_c = self.interface.call_herald_event("telegram", "pong")
|
tasks = {}
|
||||||
discord_c = self.interface.call_herald_event("discord", "pong")
|
|
||||||
constellation_c = self.interface.call_herald_event("constellation", "pong")
|
|
||||||
|
|
||||||
telegram_t = self.loop.create_task(telegram_c)
|
for target in self._targets:
|
||||||
discord_t = self.loop.create_task(discord_c)
|
tasks[target] = self.loop.create_task(self.interface.call_herald_event(target, "pong"))
|
||||||
constellation_t = self.loop.create_task(constellation_c)
|
|
||||||
|
|
||||||
await asyncio.sleep(10)
|
await asyncio.sleep(10)
|
||||||
|
|
||||||
try:
|
|
||||||
telegram_r = telegram_t.result()
|
|
||||||
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
|
||||||
telegram_r = None
|
|
||||||
try:
|
|
||||||
discord_r = discord_t.result()
|
|
||||||
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
|
||||||
discord_r = None
|
|
||||||
try:
|
|
||||||
constellation_r = constellation_t.result()
|
|
||||||
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
|
||||||
constellation_r = None
|
|
||||||
|
|
||||||
lines = ["📶 [b]Pong![/b]", ""]
|
lines = ["📶 [b]Pong![/b]", ""]
|
||||||
|
|
||||||
if telegram_r:
|
for name, task in tasks.items():
|
||||||
lines.append("🔵 Telegram")
|
try:
|
||||||
else:
|
print(task.result())
|
||||||
lines.append("🔴 Telegram")
|
except (asyncio.CancelledError, asyncio.InvalidStateError):
|
||||||
if discord_r:
|
lines.append(f"🔴 [c]{name}[/c]")
|
||||||
lines.append("🔵 Discord")
|
else:
|
||||||
else:
|
lines.append(f"🔵 [c]{name}[/c]")
|
||||||
lines.append("🔴 Discord")
|
|
||||||
if constellation_r:
|
|
||||||
lines.append("🔵 Constellation")
|
|
||||||
else:
|
|
||||||
lines.append("🔴 Constellation")
|
|
||||||
|
|
||||||
await data.reply("\n".join(lines))
|
await data.reply("\n".join(lines))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
semantic = "5.9.2"
|
semantic = "5.9.3"
|
||||||
|
|
Loading…
Reference in a new issue