1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 03:24:20 +00:00

Add /version command

This commit is contained in:
Steffo 2021-04-25 23:33:35 +02:00
parent 4a5391cb14
commit b4665a407b
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 30 additions and 0 deletions

View file

@ -65,6 +65,7 @@ register_telegram(commands.fiorygi_transactions_self, ["transactions"])
register_telegram(commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)") register_telegram(commands.fiorygi_transactions_other, ["transactions"], r"(?P<target>\S+)")
register_telegram(commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)") register_telegram(commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+)")
register_telegram(commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?") register_telegram(commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_telegram(commands.version, ["version"])
pda.implementations["telethon.1"].register_conversation(r) pda.implementations["telethon.1"].register_conversation(r)

View file

@ -15,3 +15,4 @@ from .man import *
from .login import * from .login import *
from .whoami import * from .whoami import *
from .fiorygi import * from .fiorygi import *
from .version import *

View file

@ -0,0 +1,28 @@
import royalnet.engineer as engi
import royalnet_telethon as rt
import pkg_resources
@engi.TeleportingConversation
async def version(*, _imp: engi.PDAImplementation, _msg: engi.Message, **__):
"""
Controlla la versione attuale dei pacchetti di questo bot.
"""
# noinspection PyListCreation
msg = [
f" \uE01BVersioni\uE00B",
]
msg.append("")
msg.append(f"- \uE01Croyalnet\uE00C \uE01B{pkg_resources.get_distribution('royalnet').version}\uE00B")
if isinstance(_imp, rt.TelethonPDAImplementation):
msg.append(f"- \uE01Croyalnet_telethon\uE00C \uE01B{pkg_resources.get_distribution('royalnet_telethon').version}\uE00B")
msg.append(f"- \uE01Croyalpack\uE00C \uE01B{pkg_resources.get_distribution('royalpack').version}\uE00B")
await _msg.reply(text="\n".join(msg))
__all__ = ("version",)