mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-26 13:04:20 +00:00
💥 This is better (or worse?)
This commit is contained in:
parent
fb8e8c9038
commit
afd202677c
15 changed files with 110 additions and 183 deletions
94
poetry.lock
generated
94
poetry.lock
generated
|
@ -183,7 +183,7 @@ python-versions = "*"
|
|||
|
||||
[[package]]
|
||||
name = "royalnet"
|
||||
version = "6.3.0"
|
||||
version = "6.4.4"
|
||||
description = "A multipurpose bot framework"
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -197,7 +197,7 @@ toml = ">=0.10.1,<0.11.0"
|
|||
|
||||
[[package]]
|
||||
name = "royalnet-console"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
description = "A terminal-based frontend for the royalnet.engineer module."
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -207,11 +207,11 @@ python-versions = ">=3.8,<4.0"
|
|||
click = ">=7.1.2,<8.0.0"
|
||||
colorama = ">=0.4.4,<0.5.0"
|
||||
psutil = ">=5.8.0,<6.0.0"
|
||||
royalnet = ">=6.3.0,<6.4.0"
|
||||
royalnet = ">=6.4.0,<6.5.0"
|
||||
|
||||
[[package]]
|
||||
name = "royalnet-telethon"
|
||||
version = "1.0.0"
|
||||
version = "1.0.2"
|
||||
description = "A Telethon-based frontend for the royalnet.engineer module."
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -219,7 +219,7 @@ python-versions = ">=3.8,<4.0"
|
|||
|
||||
[package.dependencies]
|
||||
click = ">=7.1.2,<8.0.0"
|
||||
royalnet = ">=6.3.0,<6.4.0"
|
||||
royalnet = ">=6.4.0,<6.5.0"
|
||||
Telethon = ">=1.21.1,<2.0.0"
|
||||
|
||||
[[package]]
|
||||
|
@ -235,7 +235,7 @@ pyasn1 = ">=0.1.3"
|
|||
|
||||
[[package]]
|
||||
name = "sqlalchemy"
|
||||
version = "1.4.7"
|
||||
version = "1.4.8"
|
||||
description = "Database Abstraction Library"
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -310,7 +310,7 @@ multidict = ">=4.0"
|
|||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "41b994185949507e7f8285280a484f57179679c337ba81d18ab8fde6945e758c"
|
||||
content-hash = "ee3e2688b7efdc4f47dcd19bb3eab30036dbee2cc34e2123324fc3b02febac0c"
|
||||
|
||||
[metadata.files]
|
||||
aiohttp = [
|
||||
|
@ -567,56 +567,56 @@ pyreadline = [
|
|||
{file = "pyreadline-2.1.zip", hash = "sha256:4530592fc2e85b25b1a9f79664433da09237c1a270e4d78ea5aa3a2c7229e2d1"},
|
||||
]
|
||||
royalnet = [
|
||||
{file = "royalnet-6.3.0-py3-none-any.whl", hash = "sha256:f2f6ea15def33e27ca92a0ba3b7863fab7b7339bcbb99bc83f6be74bd8e805e6"},
|
||||
{file = "royalnet-6.3.0.tar.gz", hash = "sha256:6301ef60a1402ec59e55a206462f5b7296c5f6bbd6ab0bf38851ede42add5b20"},
|
||||
{file = "royalnet-6.4.4-py3-none-any.whl", hash = "sha256:5530da162209db5f2021e342e4b57a5abf3a852a678034ab920c3480836e7d96"},
|
||||
{file = "royalnet-6.4.4.tar.gz", hash = "sha256:4327b61e361d73845dc40785600d9aab5d62ae8e55e38dc3dcbf69570bd04d0f"},
|
||||
]
|
||||
royalnet-console = [
|
||||
{file = "royalnet-console-2.0.2.tar.gz", hash = "sha256:ea8e8fb9f3da51f9845f7b8841bc5d971a805bbc765970fe2a76603a49d29b1e"},
|
||||
{file = "royalnet_console-2.0.2-py3-none-any.whl", hash = "sha256:c9505dc37c8f8b9a4bb96687622f00e4516b44b8bb29ad8edd5d0acf40872487"},
|
||||
{file = "royalnet-console-2.0.3.tar.gz", hash = "sha256:52701e101bfa9a9f19543f8708aa3152e84b0fb8444ad0e22a85fc7a5a47750e"},
|
||||
{file = "royalnet_console-2.0.3-py3-none-any.whl", hash = "sha256:8a7695f585aa90dd25549a0787dc4484b0d1f61766297af9ae47cd0c262b11fb"},
|
||||
]
|
||||
royalnet-telethon = [
|
||||
{file = "royalnet-telethon-1.0.0.tar.gz", hash = "sha256:361e64f06ccdae541dd97669066b91ea36d374d57a51d07703be490ef362e867"},
|
||||
{file = "royalnet_telethon-1.0.0-py3-none-any.whl", hash = "sha256:1879cf8bc00f25bf0809e22da319f631e266fae3073c371893a4057f30bdbb02"},
|
||||
{file = "royalnet-telethon-1.0.2.tar.gz", hash = "sha256:cf2dd0394576bbf9e3b9a9355273e898af85acbdbbe2efc20c36a697fb093d61"},
|
||||
{file = "royalnet_telethon-1.0.2-py3-none-any.whl", hash = "sha256:64503dde289e71c3faa3b7b0e005b66081a6a86645d0d811d4c4b671db3267e8"},
|
||||
]
|
||||
rsa = [
|
||||
{file = "rsa-4.7.2-py3-none-any.whl", hash = "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2"},
|
||||
{file = "rsa-4.7.2.tar.gz", hash = "sha256:9d689e6ca1b3038bc82bf8d23e944b6b6037bc02301a574935b2dd946e0353b9"},
|
||||
]
|
||||
sqlalchemy = [
|
||||
{file = "SQLAlchemy-1.4.7-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:e9c2aaaa9738ba3334262734bd25d9b2d6ea446400f815bbdea17571b9e6d8fb"},
|
||||
{file = "SQLAlchemy-1.4.7-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:94fece3fdc777fbf37378513414bcf19ae89e1b598edf33d957a2898991d714f"},
|
||||
{file = "SQLAlchemy-1.4.7-cp27-cp27m-win32.whl", hash = "sha256:58075eab5e32daf51e637ac88c63057c3a5e84602cfeb30db4258838ef6f7a2b"},
|
||||
{file = "SQLAlchemy-1.4.7-cp27-cp27m-win_amd64.whl", hash = "sha256:8df743c79181ecc6aadaf10569d452ef3eda06764fe0adc4ea981a48c01e1ad5"},
|
||||
{file = "SQLAlchemy-1.4.7-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb69a2d93c1a98a8d4ca24a8012ade4b771087dddbe077ad4ef4911d7f17185d"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:d10117c9ce096bd6fb9a13c6fad274982f7889028e22a05719a6d219e2cf977e"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:abf18c62c4740d7199e443537066904789052d6d165cb279eb91bea35ea42ec4"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:8672ff62c9d48f62aa17bb806a591cdfed801d139eecbcf9224bffb80f6fdc30"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:8ecabd4cead9a582e2ffa7a3918bc31155d5c24b1fd16ed617171f913c438da1"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:e98934855337d76aa7726f444b0fa597a462271a95d01bc050644d88e1ee5aae"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-win32.whl", hash = "sha256:6adb07e199781457b75f4773e63577a2898f95141f030b956a2a186055f24e76"},
|
||||
{file = "SQLAlchemy-1.4.7-cp36-cp36m-win_amd64.whl", hash = "sha256:d81a68df4f3eee490b66ba990648d3c77cbf2475291ef92aa4e05ef541ecfd66"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:ef6d98d5b51eb826516499429e059872b61e272cb44630ca8de87650242d07d8"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d5ef5619d421f8a86af874f867d17d823cd970ad0f2ae7c30723beb16922b4d6"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:c74310f13e5a113ef658345e2cedf9aa1fcb8b9a588e07d54c083c7fc71edf42"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:069fcda89c7d168382f674b5b566643f1420e4e7704c00cced2579675deb4eed"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:673cb375deb17e1561340710f428b33c27a11980d991a2ac88d7bf1c623faa0b"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-win32.whl", hash = "sha256:aea57c7a5a4135abc10f81ce433b23325cbb9648a5dcb0ac1af1cdd413f7d0cb"},
|
||||
{file = "SQLAlchemy-1.4.7-cp37-cp37m-win_amd64.whl", hash = "sha256:6913ea108e7583f2d7ba4bc9cf4f2b1e0cdacf7e66e4cdc04192f870e64306ff"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:72152b64508dd807ba2a26d9dfc4da450d0ba1808c9f96ddbc397c435735fac3"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9de4c84ea180c07f1d4010db2cfdbf9fe67bf7caafcfb1053644c8c03bfa3fd0"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:89860d594cb3256718d74ff7406a405a890eac71bcc044b3ba6868850d934a48"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:5d84442d85491dc473bf99f4d90ad45dd2e5539743f4d1216b15ba26575ba572"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:fdd1e4ed5d526aa4c7a01ed2157d01f0234eaecdb04b1c3b5084d0902986be9f"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-win32.whl", hash = "sha256:3a022a7985a49cacf21e2a73bab083e4852943466d250d932554650d705fcc62"},
|
||||
{file = "SQLAlchemy-1.4.7-cp38-cp38-win_amd64.whl", hash = "sha256:a7f450cbab9670949e7d9f0eac1dd93eaaffce319608bf4b863f0b751decef42"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:2bfadb3279f51252565baed9aa071c1bef875fcde60bf4a172136289ac208804"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1d1172a9e5ead90d9299ccad8c5eecf40372a3721ff82fc4b4ee42835baf4659"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:bea07faab746743c8d82650b51129ff2705d53a0094161cfa6145e7ce77b9644"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:a3a40d2a0cb2ca2886f8f2fe768e83aeca489a162c8233974b9b2e429827ed85"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:50b1cb7c9f6f0bbc68c06453d66d4a34ca75ba60bce61d49bf007edfd2621d0a"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-win32.whl", hash = "sha256:d26d8a3865c9f33d7b3b356a577c7f26c499a9f080ae33e4282a65a8a2170cef"},
|
||||
{file = "SQLAlchemy-1.4.7-cp39-cp39-win_amd64.whl", hash = "sha256:606ac6a7640cc642fd53c5e693c560ad9fc21ef97aa7e799eb96b6d7f28ad723"},
|
||||
{file = "SQLAlchemy-1.4.7.tar.gz", hash = "sha256:84115f97d88c8ccf26db81b7997c5f5de9ae360e0785ef859d0987794495f0a9"},
|
||||
{file = "SQLAlchemy-1.4.8-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:dec822c2a9436092798998475b3b8edd0d59be7fecdd5fb8411ac8db1575ed64"},
|
||||
{file = "SQLAlchemy-1.4.8-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:15480706c51bdf72d726d0efde77eef6b5f09fbef65bc520f2c4e1f3a429fddf"},
|
||||
{file = "SQLAlchemy-1.4.8-cp27-cp27m-win32.whl", hash = "sha256:221ead411c5e455bbe32b8eb2e8521a31a0769684a93b6895e515e9ce3a49906"},
|
||||
{file = "SQLAlchemy-1.4.8-cp27-cp27m-win_amd64.whl", hash = "sha256:46a454a366f6274c18d3204d11b9e4b98a5c99cba99230e24848d82bef069f75"},
|
||||
{file = "SQLAlchemy-1.4.8-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:81ea6270359629b9c56251bdfc12f2a8afb55034a3ff3698b6a764b300bfe605"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:831aa088b0056b8040423c53543b5bf5663d1d5ffbc175387f2216de7780113e"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:b8280da3f36b9156ff251a14e5a3e82a4bb58958bdddbd0867cd29e6f3f809de"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:767c0bbe5af14c2ebcad7314faea9709b59593daa3250fe6224429a344c21438"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:8a067fbf3ea3f53e4223990d92a8e44259571ef182039ddcb4ffcf217e08a901"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:43b4958d959b1ee00540b963620f6bffacdd8ac0a19d31450828a1cbacf3693c"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-win32.whl", hash = "sha256:b6106343fb97771f20cd945ce6b1d07f8247121d1d4baad062c028e5f0a1f034"},
|
||||
{file = "SQLAlchemy-1.4.8-cp36-cp36m-win_amd64.whl", hash = "sha256:fc5dea79bd2626ee2ed034144f6c590441e7c8c036c57c1939ec4a18481c0de1"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:1dc4f31124cc359065dceef1a9afe4e2d07a05b2e1e184f5fa48cba96c2249a3"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c1457a86209c56dfdd1a62904445bc727f962226bf8866f3834fffff8bd7282d"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:ddc9de7e46e8044099a94b8d8b92b02693df030ca8684aa775908295270a3556"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:6d18aec6f16b48b2903940776d0f455d82b0c35f4b307ae5393987c600f8fcda"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:64a6645ee39f45f153b45addace5727aef7eb517b115c8bdc77e02be8c8c43a3"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-win32.whl", hash = "sha256:d37683c5d84f0694f159a2a515a34f81daf7da96e7efb9ba9d5daf4ae8dde47e"},
|
||||
{file = "SQLAlchemy-1.4.8-cp37-cp37m-win_amd64.whl", hash = "sha256:de2e700a2e98b4c621976fdb3174e9e5947c38efedcf60e6d7c20cc7dddb3a99"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:e7a4bcb79aa64f1bf995dc2f5966fccc7d21b99cdfb63b57c609cfdba2ea5906"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:fccd2de1b3b47ca62c2fa5d344e16266a6edc8cce8b80f32e40126df60dbd2c4"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:ed660a67c0d8690078560d62767a69b359409863827b367167f18fa14ca51ff6"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fe2558be48c92a9be69bd9e7c41bfc46714c5eafc4d59f85fdc338d6999c4962"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:859cf5aae0ecc1aa526f9cebdf6ae8078527f0f3aa3fb10156ecc1d044c1c545"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-win32.whl", hash = "sha256:4b0404b7a18658d5661120ae0f6f57b220c57126d07a067bfdff304d4c50eaa3"},
|
||||
{file = "SQLAlchemy-1.4.8-cp38-cp38-win_amd64.whl", hash = "sha256:49a85c143f90c74b1d000506e125476d4dec3342f8052ad98e007fb5c657c46c"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:29e135f8c890c16251162dd40022074430fc39668c8666220a73cb500a3697af"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:a7641c8a2d008ee8cef21d3b9eaf7f68259b965318055148fbc5ae6961ae287e"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:aa470facb52b927a5a5a1a4755b1452f7e77dcf93e822077354075e7a811bec2"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:76354282fbb3e5b33aee8fcfc2394c7b26d08c53025960d41abc57a6222321cc"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:cb08be4a43ce6729b37efb95816258b00bbd3442eef4a740c09384fb9fe99076"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-win32.whl", hash = "sha256:eff2c66e930030110a6139b0374013fa1f1a397a67a0c8a1a5d387ca2a112b45"},
|
||||
{file = "SQLAlchemy-1.4.8-cp39-cp39-win_amd64.whl", hash = "sha256:1e1c2c65f732f7740d184b4133e5207c0f8974663ab1b79ce1b599ecf55bd3e9"},
|
||||
{file = "SQLAlchemy-1.4.8.tar.gz", hash = "sha256:3bc31ad707f8587c9f93d50cd7cee80ba352162d322808ddbb5bcb5fcfd2bb83"},
|
||||
]
|
||||
telethon = [
|
||||
{file = "Telethon-1.21.1-py3-none-any.whl", hash = "sha256:df643fc988708ad16d16de834ffa12ad4bfa3f956473d835c8158e2283b885ea"},
|
||||
|
|
|
@ -19,9 +19,9 @@ python = "^3.8"
|
|||
coloredlogs = "^15.0"
|
||||
aiohttp = "^3.7.4"
|
||||
psycopg2 = "^2.8.6"
|
||||
royalnet = "~6.3.0"
|
||||
royalnet_telethon = "^1.0.0"
|
||||
royalnet_console = "^2.0.0"
|
||||
royalnet = "~6.4.4"
|
||||
royalnet_telethon = "^1.0.2"
|
||||
royalnet_console = "^2.0.3"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
import royalnet.engineer as engi
|
||||
from royalnet.engineer import router
|
||||
import royalnet.scrolls as sc
|
||||
import royalnet_console as rc
|
||||
import royalnet_telethon as rt
|
||||
import pathlib
|
||||
import re
|
||||
import coloredlogs
|
||||
|
||||
from . import commands
|
||||
from .database import engine, base
|
||||
|
||||
coloredlogs.install(level="DEBUG", isatty=True)
|
||||
|
||||
config = sc.Scroll.from_file(namespace="ROYALPACK", file_path=pathlib.Path("royalpack.cfg.toml"))
|
||||
|
||||
engine_ = engine.lazy_engine.evaluate()
|
||||
base.Base.metadata.create_all(engine_)
|
||||
|
||||
pda = engi.PDA(implementations=[
|
||||
# rc.ConsolePDAImplementation(
|
||||
# name="1",
|
||||
# extensions=[
|
||||
# engi.SQLAlchemyExtension(engine=engine_),
|
||||
# ]
|
||||
# ),
|
||||
rt.TelethonPDAImplementation(
|
||||
name="1",
|
||||
extensions=[
|
||||
|
@ -34,22 +28,36 @@ pda = engi.PDA(implementations=[
|
|||
)
|
||||
])
|
||||
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.ahnonlosoio, ["ahnonlosoio"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.answer, ["answer"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.cat, ["cat"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.ciaoruozi, ["ciaoruozi"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.color, ["color"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.ping, ["ping"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.ship, ["ship"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.rage_show, ["rage"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.rage_add, ["rage"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.debug, ["debug"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.debug_impls, ["debug"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.debug_exts, ["debug"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.debug_convs, ["debug"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.ciao, ["ciao"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.help_cmd, ["help"])
|
||||
pda.implementations["telethon.1"].register_partialcommand(commands.help_single, ["help"])
|
||||
r = router.Router()
|
||||
|
||||
|
||||
def register_telegram(conv, names, syntax=None):
|
||||
name_regex = rf"(?:{'|'.join(names)})"
|
||||
bot_regex = rf"(?:@{config['telegram.bot.username']})?"
|
||||
if syntax:
|
||||
syntax_regex = f" {syntax}"
|
||||
else:
|
||||
syntax_regex = ""
|
||||
regex = rf"^/{name_regex}{bot_regex}{syntax_regex}$"
|
||||
r.register_conversation(conv, names, [re.compile(regex)])
|
||||
|
||||
|
||||
register_telegram(commands.ahnonlosoio, ["ahnonlosoio"])
|
||||
register_telegram(commands.answer, ["answer"], r".+")
|
||||
register_telegram(commands.cat, ["cat"])
|
||||
register_telegram(commands.ciaoruozi, ["ciaoruozi"])
|
||||
register_telegram(commands.color, ["color"])
|
||||
register_telegram(commands.ping, ["ping"])
|
||||
register_telegram(commands.ship, ["ship"], r"(?P<first>[A-Za-z]+)[\s+&]+(?P<second>[A-Za-z]+)")
|
||||
register_telegram(commands.rage_show, ["rage"])
|
||||
register_telegram(commands.rage_add, ["rage"], r"(?P<reason>.+)")
|
||||
register_telegram(commands.debug, ["debug"])
|
||||
register_telegram(commands.debug_impls, ["debug"], r"impls")
|
||||
register_telegram(commands.debug_exts, ["debug"], r"exts (?P<impl>\S+)")
|
||||
register_telegram(commands.debug_convs, ["debug"], r"convs (?P<impl>\S+)")
|
||||
register_telegram(commands.ciao, ["ciao"])
|
||||
|
||||
pda.implementations["telethon.1"].register_conversation(r)
|
||||
|
||||
|
||||
pda.run()
|
||||
|
|
|
@ -8,4 +8,3 @@ from .ship import *
|
|||
from .rage import *
|
||||
from .debug import *
|
||||
from .ciao import *
|
||||
from .help import *
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def ahnonlosoio(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
"""
|
||||
Ah, non lo so io!
|
||||
|
|
|
@ -1,21 +1,9 @@
|
|||
# Special imports
|
||||
from __future__ import annotations
|
||||
import royalnet.royaltyping as t
|
||||
|
||||
# External imports
|
||||
import logging
|
||||
import random
|
||||
import datetime
|
||||
import royalnet.engineer as engi
|
||||
|
||||
# Internal imports
|
||||
# from . import something
|
||||
|
||||
# Special global objects
|
||||
log = logging.getLogger(__name__)
|
||||
import royalnet.engineer.conversation as c
|
||||
import datetime
|
||||
import random
|
||||
|
||||
|
||||
# Code
|
||||
ANSWERS = [
|
||||
# Cerchiamo di tenere bilanciate le tre colonne, o almeno le prime due.
|
||||
# Se avete un'idea ma metterebbe troppe opzioni in un'unica categoria, mettetela sotto commento.
|
||||
|
@ -85,7 +73,7 @@ ANSWERS = [
|
|||
]
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=".*")
|
||||
@engi.TeleportingConversation
|
||||
async def answer(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
"""
|
||||
Fai una domanda al bot, che possa essere risposta con un sì o un no: lui ti risponderà!
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
# Special imports
|
||||
from __future__ import annotations
|
||||
import royalnet.royaltyping as t
|
||||
|
||||
# External imports
|
||||
import aiohttp
|
||||
import royalnet.engineer as engi
|
||||
import royalnet.engineer.conversation as c
|
||||
import aiohttp
|
||||
import logging
|
||||
import io
|
||||
|
||||
# Internal imports
|
||||
# from . import something
|
||||
|
||||
# Special global objects
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Code
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def cat(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
"""
|
||||
Send a cat in the chat! 🐈
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet.engineer.conversation as c
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="", lock=False)
|
||||
@engi.TeleportingConversation
|
||||
async def ciao(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
await _msg.reply(text="👋 Ciao, chi sei?")
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet_telethon as rt
|
||||
import royalnet_telethon.bullet.contents as rtc
|
||||
import royalnet.engineer.conversation as c
|
||||
import royalnet_telethon
|
||||
import royalnet_telethon.bullet.contents
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def ciaoruozi(*, _sentry: engi.Sentry, _msg: engi.Message, _imp, **__):
|
||||
"""
|
||||
Saluta Ruozi, una creatura leggendaria che potrebbe esistere o non esistere in Royal Games.
|
||||
"""
|
||||
|
||||
if isinstance(_imp, rt.TelethonPDAImplementation):
|
||||
sender: rtc.TelegramUser = await _msg.sender
|
||||
if isinstance(_imp, royalnet_telethon.TelethonPDAImplementation):
|
||||
sender: royalnet_telethon.bullet.contents.TelegramUser = await _msg.sender
|
||||
# noinspection PyProtectedMember
|
||||
if sender._user.id == 112437036:
|
||||
await _msg.reply(text="👋 Ciao me!")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet.engineer.conversation as c
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def color(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
"""
|
||||
Invia un colore in chat...?
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import royalnet.engineer as engi
|
||||
import royalnet_telethon as rt
|
||||
|
||||
|
||||
newline = "\n"
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def debug(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, **__):
|
||||
"""
|
||||
Check the implementations currently running on the PDA.
|
||||
|
@ -17,7 +17,7 @@ async def debug(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, **_
|
|||
""")
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=r"impls")
|
||||
@engi.TeleportingConversation
|
||||
async def debug_impls(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, **__):
|
||||
await _msg.reply(text=f"""
|
||||
🐛 Implementazioni attive sul PDA:
|
||||
|
@ -26,7 +26,7 @@ async def debug_impls(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PD
|
|||
""")
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=r"exts (?P<impl>\S+)")
|
||||
@engi.TeleportingConversation
|
||||
async def debug_exts(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, impl: str, **__):
|
||||
await _msg.reply(text=f"""
|
||||
🐛 Estensioni attive sull'implementazione {impl}:
|
||||
|
@ -35,7 +35,7 @@ async def debug_exts(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA
|
|||
""")
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=r"convs (?P<impl>\S+)")
|
||||
@engi.TeleportingConversation
|
||||
async def debug_convs(*, _sentry: engi.Sentry, _msg: engi.Message, _pda: engi.PDA, impl: str, **__):
|
||||
implementation = _pda.implementations[impl]
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=r"")
|
||||
async def help_cmd(*, _sentry: engi.Sentry, _imp: engi.PDAImplementation, _msg: engi.Message, **__):
|
||||
if not isinstance(_imp, engi.ConversationListImplementation):
|
||||
await _msg.reply(text="⚠️ Questa implementazione gestisce i comandi con un metodo sconosciuto.")
|
||||
|
||||
commands = [command for command in _imp.conversations if isinstance(command, engi.FullCommand)]
|
||||
names = set([command.name() for command in commands])
|
||||
text = ["ℹ️ Comandi disponibili:"]
|
||||
for name in names:
|
||||
text.append(f"- {name}")
|
||||
text = "\n".join(text)
|
||||
|
||||
await _msg.reply(text=text)
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax=r"(?P<cmd>\S+)")
|
||||
async def help_single(*, _sentry: engi.Sentry, _imp: engi.PDAImplementation, _msg: engi.Message, cmd: str, **__):
|
||||
if not isinstance(_imp, engi.ConversationListImplementation):
|
||||
await _msg.reply(text="⚠️ Questa implementazione gestisce i comandi con un metodo sconosciuto.")
|
||||
|
||||
commands = [
|
||||
command
|
||||
for command in _imp.conversations
|
||||
if isinstance(command, engi.FullCommand)
|
||||
and cmd in command.names
|
||||
]
|
||||
|
||||
text = [f"ℹ️ Sottocomandi di {cmd} disponibili:"]
|
||||
|
||||
for command in commands:
|
||||
text.append("")
|
||||
text.append("")
|
||||
text.append(f"{command}")
|
||||
text.append(f" {command.pattern.pattern}")
|
||||
text.append("")
|
||||
if ht := command.help():
|
||||
text.append(ht.strip())
|
||||
else:
|
||||
text.append("Questo comando non ha un help text.")
|
||||
|
||||
text = "\n".join(text)
|
||||
|
||||
await _msg.reply(text=text)
|
||||
|
||||
|
||||
__all__ = (
|
||||
"help_cmd",
|
||||
"help_single",
|
||||
)
|
|
@ -1,7 +1,7 @@
|
|||
import royalnet.engineer as engi
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def ping(*, _sentry: engi.Sentry, _msg: engi.Message, **__):
|
||||
"""
|
||||
A way to check if the bot is working: it will always reply to this command with "🏓 Pong!".
|
||||
|
|
|
@ -4,7 +4,7 @@ import sqlalchemy as s
|
|||
import sqlalchemy.orm as so
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="")
|
||||
@engi.TeleportingConversation
|
||||
async def rage_show(*, _sentry: engi.Sentry, _msg: engi.Message, _session: so.Session, **__):
|
||||
"""
|
||||
A-N-G-E-R-Y!
|
||||
|
@ -21,7 +21,7 @@ async def rage_show(*, _sentry: engi.Sentry, _msg: engi.Message, _session: so.Se
|
|||
await _msg.reply(text=f"😡 {rage.reason}")
|
||||
|
||||
|
||||
@engi.PartialCommand.new(syntax="(?P<reason>.+)")
|
||||
@engi.TeleportingConversation
|
||||
async def rage_add(*, _sentry: engi.Sentry, _msg: engi.Message, _session: so.Session, reason: str, **__):
|
||||
"""
|
||||
A-N-G-E-R-Y!
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
# Special imports
|
||||
from __future__ import annotations
|
||||
import royalnet.royaltyping as t
|
||||
|
||||
# External imports
|
||||
import royalnet.engineer as engi
|
||||
import logging
|
||||
import re
|
||||
|
||||
# Internal imports
|
||||
# from . import something
|
||||
|
||||
# Special global objects
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Code
|
||||
@engi.PartialCommand.new(syntax=r"(?P<first>[A-Za-z]+)[\s+&]+(?P<second>[A-Za-z]+)")
|
||||
@engi.TeleportingConversation
|
||||
async def ship(*, _sentry: engi.Sentry, _msg: engi.Message, first: str, second: str, **__):
|
||||
"""
|
||||
Ship two names together! 💞
|
||||
|
|
Loading…
Reference in a new issue