mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Add steampowered command
This commit is contained in:
parent
6623853a8d
commit
91e1ef6d1f
6 changed files with 271 additions and 1 deletions
155
poetry.lock
generated
155
poetry.lock
generated
|
@ -152,6 +152,44 @@ optional = false
|
|||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "0.18.2"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Coroutine-based network library"
|
||||
name = "gevent"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||
version = "1.4.0"
|
||||
|
||||
[package.dependencies]
|
||||
cffi = ">=1.11.5"
|
||||
greenlet = ">=0.4.14"
|
||||
|
||||
[package.extras]
|
||||
dnspython = ["dnspython", "idna"]
|
||||
doc = ["repoze.sphinx.autointerface"]
|
||||
events = ["zope.event", "zope.interface"]
|
||||
test = ["zope.interface", "zope.event", "requests", "objgraph", "psutil", "futures", "mock", "coverage (>=5.0a3)", "coveralls (>=1.0)"]
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Implements EventEmitter using gevent"
|
||||
name = "gevent-eventemitter"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "2.1"
|
||||
|
||||
[package.dependencies]
|
||||
gevent = ">=1.3"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Lightweight in-process concurrent programming"
|
||||
marker = "platform_python_implementation == \"CPython\""
|
||||
name = "greenlet"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.4.15"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
|
||||
|
@ -286,6 +324,18 @@ optional = false
|
|||
python-versions = ">=3.5"
|
||||
version = "4.7.4"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Protocol Buffers"
|
||||
name = "protobuf"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "3.11.2"
|
||||
|
||||
[package.dependencies]
|
||||
setuptools = "*"
|
||||
six = ">=1.9"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "psycopg2 - Python-PostgreSQL Database Adapter"
|
||||
|
@ -587,6 +637,23 @@ version = "0.12.13"
|
|||
[package.extras]
|
||||
full = ["aiofiles", "graphene", "itsdangerous", "jinja2", "python-multipart", "pyyaml", "requests", "ujson"]
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Module for interacting with various Steam features"
|
||||
name = "steam"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.9.1"
|
||||
|
||||
[package.dependencies]
|
||||
cryptography = ">=1.3"
|
||||
gevent = ">=1.2.0"
|
||||
gevent-eventemitter = ">=2.0"
|
||||
protobuf = ">=3.0.0"
|
||||
requests = ">=2.9.1"
|
||||
six = ">=1.10"
|
||||
vdf = ">=2.0"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "A python wrapper for the Discord API"
|
||||
|
@ -675,6 +742,14 @@ optional = false
|
|||
python-versions = "*"
|
||||
version = "0.14.0"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "Library for working with Valve's VDF text format"
|
||||
name = "vdf"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "3.2"
|
||||
|
||||
[[package]]
|
||||
category = "main"
|
||||
description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
|
||||
|
@ -704,7 +779,7 @@ python-versions = "*"
|
|||
version = "2020.1.15"
|
||||
|
||||
[metadata]
|
||||
content-hash = "84e93ee35c496ee10d2c2552ad6c38ec257dca2c8f9a91d2b4e4e4940057588a"
|
||||
content-hash = "e5c540dccfd2912ee3a397f3fdce2ed537273be220eecff046af58fd12c65d66"
|
||||
python-versions = "^3.8"
|
||||
|
||||
[metadata.files]
|
||||
|
@ -829,6 +904,56 @@ ffmpeg-python = [
|
|||
future = [
|
||||
{file = "future-0.18.2.tar.gz", hash = "sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"},
|
||||
]
|
||||
gevent = [
|
||||
{file = "gevent-1.4.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1b7d3a285978b27b469c0ff5fb5a72bcd69f4306dbbf22d7997d83209a8ba917"},
|
||||
{file = "gevent-1.4.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:44089ed06a962a3a70e96353c981d628b2d4a2f2a75ea5d90f916a62d22af2e8"},
|
||||
{file = "gevent-1.4.0-cp27-cp27m-win32.whl", hash = "sha256:0e1e5b73a445fe82d40907322e1e0eec6a6745ca3cea19291c6f9f50117bb7ea"},
|
||||
{file = "gevent-1.4.0-cp27-cp27m-win_amd64.whl", hash = "sha256:74b7528f901f39c39cdbb50cdf08f1a2351725d9aebaef212a29abfbb06895ee"},
|
||||
{file = "gevent-1.4.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:0ff2b70e8e338cf13bedf146b8c29d475e2a544b5d1fe14045aee827c073842c"},
|
||||
{file = "gevent-1.4.0-cp34-cp34m-macosx_10_14_x86_64.whl", hash = "sha256:0774babec518a24d9a7231d4e689931f31b332c4517a771e532002614e270a64"},
|
||||
{file = "gevent-1.4.0-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:d752bcf1b98174780e2317ada12013d612f05116456133a6acf3e17d43b71f05"},
|
||||
{file = "gevent-1.4.0-cp34-cp34m-win32.whl", hash = "sha256:3249011d13d0c63bea72d91cec23a9cf18c25f91d1f115121e5c9113d753fa12"},
|
||||
{file = "gevent-1.4.0-cp34-cp34m-win_amd64.whl", hash = "sha256:d1e6d1f156e999edab069d79d890859806b555ce4e4da5b6418616322f0a3df1"},
|
||||
{file = "gevent-1.4.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:7d0809e2991c9784eceeadef01c27ee6a33ca09ebba6154317a257353e3af922"},
|
||||
{file = "gevent-1.4.0-cp35-cp35m-win32.whl", hash = "sha256:14b4d06d19d39a440e72253f77067d27209c67e7611e352f79fe69e0f618f76e"},
|
||||
{file = "gevent-1.4.0-cp35-cp35m-win_amd64.whl", hash = "sha256:53b72385857e04e7faca13c613c07cab411480822ac658d97fd8a4ddbaf715c8"},
|
||||
{file = "gevent-1.4.0-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:8d9ec51cc06580f8c21b41fd3f2b3465197ba5b23c00eb7d422b7ae0380510b0"},
|
||||
{file = "gevent-1.4.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:2711e69788ddb34c059a30186e05c55a6b611cb9e34ac343e69cf3264d42fe1c"},
|
||||
{file = "gevent-1.4.0-cp36-cp36m-win32.whl", hash = "sha256:e5bcc4270671936349249d26140c267397b7b4b1381f5ec8b13c53c5b53ab6e1"},
|
||||
{file = "gevent-1.4.0-cp36-cp36m-win_amd64.whl", hash = "sha256:9f7a1e96fec45f70ad364e46de32ccacab4d80de238bd3c2edd036867ccd48ad"},
|
||||
{file = "gevent-1.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:50024a1ee2cf04645535c5ebaeaa0a60c5ef32e262da981f4be0546b26791950"},
|
||||
{file = "gevent-1.4.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:4bfa291e3c931ff3c99a349d8857605dca029de61d74c6bb82bd46373959c942"},
|
||||
{file = "gevent-1.4.0-cp37-cp37m-win32.whl", hash = "sha256:ab4dc33ef0e26dc627559786a4fba0c2227f125db85d970abbf85b77506b3f51"},
|
||||
{file = "gevent-1.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:896b2b80931d6b13b5d9feba3d4eebc67d5e6ec54f0cf3339d08487d55d93b0e"},
|
||||
{file = "gevent-1.4.0-pp260-pypy_41-macosx_10_14_x86_64.whl", hash = "sha256:107f4232db2172f7e8429ed7779c10f2ed16616d75ffbe77e0e0c3fcdeb51a51"},
|
||||
{file = "gevent-1.4.0-pp260-pypy_41-win32.whl", hash = "sha256:28a0c5417b464562ab9842dd1fb0cc1524e60494641d973206ec24d6ec5f6909"},
|
||||
{file = "gevent-1.4.0.tar.gz", hash = "sha256:1eb7fa3b9bd9174dfe9c3b59b7a09b768ecd496debfc4976a9530a3e15c990d1"},
|
||||
]
|
||||
gevent-eventemitter = [
|
||||
{file = "gevent-eventemitter-2.1.tar.gz", hash = "sha256:00e6e688c6a255f7bdcef1d8c999e0d02d9ab87d3c6ff626e6dc1a09762107f4"},
|
||||
{file = "gevent_eventemitter-2.1-py2.py3-none-any.whl", hash = "sha256:30605a9fbb1f38b2511f188a2e7a1b4e9262f3c13bf810ac5b79cc0ba2900ff7"},
|
||||
]
|
||||
greenlet = [
|
||||
{file = "greenlet-0.4.15-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:99a26afdb82ea83a265137a398f570402aa1f2b5dfb4ac3300c026931817b163"},
|
||||
{file = "greenlet-0.4.15-cp27-cp27m-win32.whl", hash = "sha256:beeabe25c3b704f7d56b573f7d2ff88fc99f0138e43480cecdfcaa3b87fe4f87"},
|
||||
{file = "greenlet-0.4.15-cp27-cp27m-win_amd64.whl", hash = "sha256:9854f612e1b59ec66804931df5add3b2d5ef0067748ea29dc60f0efdcda9a638"},
|
||||
{file = "greenlet-0.4.15-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:ac57fcdcfb0b73bb3203b58a14501abb7e5ff9ea5e2edfa06bb03035f0cff248"},
|
||||
{file = "greenlet-0.4.15-cp33-cp33m-win32.whl", hash = "sha256:d634a7ea1fc3380ff96f9e44d8d22f38418c1c381d5fac680b272d7d90883720"},
|
||||
{file = "greenlet-0.4.15-cp33-cp33m-win_amd64.whl", hash = "sha256:0d48200bc50cbf498716712129eef819b1729339e34c3ae71656964dac907c28"},
|
||||
{file = "greenlet-0.4.15-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:bcb530089ff24f6458a81ac3fa699e8c00194208a724b644ecc68422e1111939"},
|
||||
{file = "greenlet-0.4.15-cp34-cp34m-win32.whl", hash = "sha256:8b4572c334593d449113f9dc8d19b93b7b271bdbe90ba7509eb178923327b625"},
|
||||
{file = "greenlet-0.4.15-cp34-cp34m-win_amd64.whl", hash = "sha256:a9f145660588187ff835c55a7d2ddf6abfc570c2651c276d3d4be8a2766db490"},
|
||||
{file = "greenlet-0.4.15-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:51503524dd6f152ab4ad1fbd168fc6c30b5795e8c70be4410a64940b3abb55c0"},
|
||||
{file = "greenlet-0.4.15-cp35-cp35m-win32.whl", hash = "sha256:a19bf883b3384957e4a4a13e6bd1ae3d85ae87f4beb5957e35b0be287f12f4e4"},
|
||||
{file = "greenlet-0.4.15-cp35-cp35m-win_amd64.whl", hash = "sha256:853da4f9563d982e4121fed8c92eea1a4594a2299037b3034c3c898cb8e933d6"},
|
||||
{file = "greenlet-0.4.15-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:23d12eacffa9d0f290c0fe0c4e81ba6d5f3a5b7ac3c30a5eaf0126bf4deda5c8"},
|
||||
{file = "greenlet-0.4.15-cp36-cp36m-win32.whl", hash = "sha256:000546ad01e6389e98626c1367be58efa613fa82a1be98b0c6fc24b563acc6d0"},
|
||||
{file = "greenlet-0.4.15-cp36-cp36m-win_amd64.whl", hash = "sha256:d97b0661e1aead761f0ded3b769044bb00ed5d33e1ec865e891a8b128bf7c656"},
|
||||
{file = "greenlet-0.4.15-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:8041e2de00e745c0e05a502d6e6db310db7faa7c979b3a5877123548a4c0b214"},
|
||||
{file = "greenlet-0.4.15-cp37-cp37m-win32.whl", hash = "sha256:81fcd96a275209ef117e9ec91f75c731fa18dcfd9ffaa1c0adbdaa3616a86043"},
|
||||
{file = "greenlet-0.4.15-cp37-cp37m-win_amd64.whl", hash = "sha256:37c9ba82bd82eb6a23c2e5acc03055c0e45697253b2393c9a50cef76a3985304"},
|
||||
{file = "greenlet-0.4.15.tar.gz", hash = "sha256:9416443e219356e3c31f1f918a91badf2e37acf297e2fa13d24d1cc2380f8fbc"},
|
||||
]
|
||||
h11 = [
|
||||
{file = "h11-0.9.0-py2.py3-none-any.whl", hash = "sha256:4bc6d6a1238b7615b266ada57e0618568066f57dd6fa967d1290ec9309b2f2f1"},
|
||||
{file = "h11-0.9.0.tar.gz", hash = "sha256:33d4bca7be0fa039f4e84d50ab00531047e53d6ee8ffbc83501ea602c169cae1"},
|
||||
|
@ -893,6 +1018,27 @@ multidict = [
|
|||
{file = "multidict-4.7.4-cp38-cp38-win_amd64.whl", hash = "sha256:5414f388ffd78c57e77bd253cf829373721f450613de53dc85a08e34d806e8eb"},
|
||||
{file = "multidict-4.7.4.tar.gz", hash = "sha256:d7d428488c67b09b26928950a395e41cc72bb9c3d5abfe9f0521940ee4f796d4"},
|
||||
]
|
||||
protobuf = [
|
||||
{file = "protobuf-3.11.2-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:3f509f7e50d806a434fe4a5fbf602516002a0f092889209fff7db82060efffc0"},
|
||||
{file = "protobuf-3.11.2-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:4571da974019849201fc1ec6626b9cea54bd11b6bed140f8f737c0a33ea37de5"},
|
||||
{file = "protobuf-3.11.2-cp35-cp35m-macosx_10_9_intel.whl", hash = "sha256:0329e86a397db2a83f9dcbe21d9be55a47f963cdabc893c3a24f4d3a8f117c37"},
|
||||
{file = "protobuf-3.11.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:56bd1d84fbf4505c7b73f04de987eef5682e5752c811141b0186a3809bfb396f"},
|
||||
{file = "protobuf-3.11.2-cp35-cp35m-win32.whl", hash = "sha256:919f0d6f6addc836d08658eba3b52be2e92fd3e76da3ce00c325d8e9826d17c7"},
|
||||
{file = "protobuf-3.11.2-cp35-cp35m-win_amd64.whl", hash = "sha256:14d6ac53df9cb5bb87c4f91b677c1bc5cec9c0fd44327f367a3c9562de2877c4"},
|
||||
{file = "protobuf-3.11.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6e96dffaf4d0a9a329e528b353ba62fd9ef13599688723d96bc9c165d0b6871e"},
|
||||
{file = "protobuf-3.11.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6b5b947dc8b3f2aec0eaad65b0b5113fcd642c358c31357c647da6281ee31104"},
|
||||
{file = "protobuf-3.11.2-cp36-cp36m-win32.whl", hash = "sha256:680c668d00b5eff08b86aef9e5ba9a705e621ea05d39071cfea8e28cb2400946"},
|
||||
{file = "protobuf-3.11.2-cp36-cp36m-win_amd64.whl", hash = "sha256:9c7b19c30cf0644afd0e4218b13f637ce54382fdcb1c8f75bf3e84e49a5f6d0a"},
|
||||
{file = "protobuf-3.11.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d61b14a9090da77fe87e38ba4c6c43d3533dcbeb5d84f5474e7ac63c532dcc9c"},
|
||||
{file = "protobuf-3.11.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:a2e6f57114933882ec701807f217df2fb4588d47f71f227c0a163446b930d507"},
|
||||
{file = "protobuf-3.11.2-cp37-cp37m-win32.whl", hash = "sha256:0a7219254afec0d488211f3d482d8ed57e80ae735394e584a98d8f30a8c88a36"},
|
||||
{file = "protobuf-3.11.2-cp37-cp37m-win_amd64.whl", hash = "sha256:a6b970a2eccfcbabe1acf230fbf112face1c4700036c95e195f3554d7bcb04c1"},
|
||||
{file = "protobuf-3.11.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d6faf5dbefb593e127463f58076b62fcfe0784187be8fe1aa9167388f24a22a1"},
|
||||
{file = "protobuf-3.11.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:bc45641cbcdea068b67438244c926f9fd3e5cbdd824448a4a64370610df7c593"},
|
||||
{file = "protobuf-3.11.2-py2.7.egg", hash = "sha256:557686c43fbd04f5f7c533f00feee9a37dcca7b5896e3ae3664a33864e6dd546"},
|
||||
{file = "protobuf-3.11.2-py2.py3-none-any.whl", hash = "sha256:180fc364b42907a1d2afa183ccbeffafe659378c236b1ec3daca524950bb918d"},
|
||||
{file = "protobuf-3.11.2.tar.gz", hash = "sha256:3d7a7d8d20b4e7a8f63f62de2d192cfd8b7a53c56caba7ece95367ca2b80c574"},
|
||||
]
|
||||
psycopg2-binary = [
|
||||
{file = "psycopg2-binary-2.8.4.tar.gz", hash = "sha256:3a2522b1d9178575acee4adf8fd9f979f9c0449b00b4164bb63c3475ea6528ed"},
|
||||
{file = "psycopg2_binary-2.8.4-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:890167d5091279a27e2505ff0e1fb273f8c48c41d35c5b92adbf4af80e6b2ed6"},
|
||||
|
@ -1062,6 +1208,9 @@ sqlalchemy = [
|
|||
starlette = [
|
||||
{file = "starlette-0.12.13.tar.gz", hash = "sha256:9597bc28e3c4659107c1c4a45ec32dc45e947d78fe56230222be673b2c36454a"},
|
||||
]
|
||||
steam = [
|
||||
{file = "steam-0.9.1.tar.gz", hash = "sha256:167240080ea23e346c11face96a6e9acc2827978c46c5ae25fa74e38031ff978"},
|
||||
]
|
||||
temp-discordpy-without-websockets-requirement = [
|
||||
{file = "temp_discordpy_without_websockets_requirement-0.1-py3-none-any.whl", hash = "sha256:361ddcc6fb2ec469706fde56c46a3e14f02671cf0e27204ef6c3c4d89c7227ab"},
|
||||
{file = "temp_discordpy_without_websockets_requirement-0.1.tar.gz", hash = "sha256:7db02603cde084c7d579d872389f60ffd3f34197d885e4ca722a92bc302cb33c"},
|
||||
|
@ -1107,6 +1256,10 @@ uvloop = [
|
|||
{file = "uvloop-0.14.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:4315d2ec3ca393dd5bc0b0089d23101276778c304d42faff5dc4579cb6caef09"},
|
||||
{file = "uvloop-0.14.0.tar.gz", hash = "sha256:123ac9c0c7dd71464f58f1b4ee0bbd81285d96cdda8bc3519281b8973e3a461e"},
|
||||
]
|
||||
vdf = [
|
||||
{file = "vdf-3.2-py2.py3-none-any.whl", hash = "sha256:8e0d33ebe0bafd991be3236ce1bd211e368e9a2b8bc376dacd5f6b77066afb90"},
|
||||
{file = "vdf-3.2.tar.gz", hash = "sha256:83f3b509fe99a4d842b74af3d0b1742be99f7098dae1d3eb7ca57522986737d5"},
|
||||
]
|
||||
websockets = [
|
||||
{file = "websockets-8.1-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:3762791ab8b38948f0c4d281c8b2ddfa99b7e510e46bd8dfa942a5fff621068c"},
|
||||
{file = "websockets-8.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:3db87421956f1b0779a7564915875ba774295cc86e81bc671631379371af1170"},
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
riotwatcher = "^2.7.1"
|
||||
royalspells = "^3.2"
|
||||
steam = "^0.9.1"
|
||||
|
||||
[tool.poetry.dependencies.royalnet]
|
||||
version = "^5.3.1"
|
||||
|
|
|
@ -31,6 +31,7 @@ from .funkwhale import FunkwhaleCommand
|
|||
from .eval import EvalCommand
|
||||
from .exec import ExecCommand
|
||||
from .trivia import TriviaCommand
|
||||
from .steampowered import SteampoweredCommand
|
||||
|
||||
# Enter the commands of your Pack here!
|
||||
available_commands = [
|
||||
|
@ -66,6 +67,7 @@ available_commands = [
|
|||
ExecCommand,
|
||||
FunkwhaleCommand,
|
||||
TriviaCommand,
|
||||
SteampoweredCommand,
|
||||
]
|
||||
|
||||
# Don't change this, it should automatically generate __all__
|
||||
|
|
67
royalpack/commands/steampowered.py
Normal file
67
royalpack/commands/steampowered.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
from typing import *
|
||||
from royalnet.commands import *
|
||||
from royalnet.utils import *
|
||||
from ..tables.steam import Steam
|
||||
import steam
|
||||
import datetime
|
||||
|
||||
|
||||
class SteampoweredCommand(Command):
|
||||
name: str = "steampowered"
|
||||
|
||||
description: str = "Connetti il tuo account di Steam!"
|
||||
|
||||
syntax: str = "{profile}"
|
||||
|
||||
def __init__(self, interface: CommandInterface):
|
||||
super().__init__(interface)
|
||||
if "Steam" not in self.config or "web_api_key" not in self.config["Steam"]:
|
||||
raise ConfigurationError("[c]Steam.web_api_key[/c] config option is missing!")
|
||||
self._api = steam.WebAPI(self.config["Steam"]["web_api_key"])
|
||||
|
||||
def _display(self, account: Steam):
|
||||
string = f"ℹ️ [b]{account.persona_name}[/b]\n" \
|
||||
f"{account.profile_url}\n" \
|
||||
f"\n" \
|
||||
f"SteamID: [c]{account.steam_id}[/c]\n" \
|
||||
f"Created on: {account.account_creation_date}\n"
|
||||
return string
|
||||
|
||||
async def _update(self, account: Steam):
|
||||
response = await asyncify(self._api.ISteamUser.GetPlayerSummaries_v2, steamids=account.steam_id)
|
||||
r = response["response"]["players"][0]
|
||||
account.persona_name = r["personaname"]
|
||||
account.profile_url = r["profileurl"]
|
||||
account.avatar = r["avatar"]
|
||||
account.primary_clan_id = r["primaryclanid"]
|
||||
account.account_creation_date = datetime.datetime.fromtimestamp(r["timecreated"])
|
||||
|
||||
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
||||
author = await data.get_author()
|
||||
if len(args) > 0:
|
||||
steamid = args.match("([0-9]+)")[0]
|
||||
response = await asyncify(self._api.ISteamUser.GetPlayerSummaries_v2, steamids=steamid)
|
||||
r = response["response"]["players"][0]
|
||||
steam_account = self.alchemy.get(Steam)(
|
||||
user=author,
|
||||
steam_id=int(steamid),
|
||||
persona_name=r["personaname"],
|
||||
profile_url=r["profileurl"],
|
||||
avatar=r["avatarfull"],
|
||||
primary_clan_id=r["primaryclanid"],
|
||||
account_creation_date=datetime.datetime.fromtimestamp(r["timecreated"])
|
||||
)
|
||||
data.session.add(steam_account)
|
||||
await data.session_commit()
|
||||
await data.reply(f"↔️ Account {steam_account} connesso a {author}!")
|
||||
else:
|
||||
# Update and display the Steam info for the current account
|
||||
if len(author.steam) == 0:
|
||||
raise UserError("Nessun account di Steam trovato.")
|
||||
message = ""
|
||||
for account in author.steam:
|
||||
await self._update(account)
|
||||
message += self._display(account)
|
||||
message += "\n"
|
||||
await data.session_commit()
|
||||
await data.reply(message)
|
|
@ -10,6 +10,7 @@ from .mmevents import MMEvent
|
|||
from .mmresponse import MMResponse
|
||||
from .leagueoflegends import LeagueOfLegends
|
||||
from .fiorygi import Fiorygi
|
||||
from .steam import Steam
|
||||
|
||||
# Enter the tables of your Pack here!
|
||||
available_tables = [
|
||||
|
@ -24,6 +25,7 @@ available_tables = [
|
|||
MMResponse,
|
||||
LeagueOfLegends,
|
||||
Fiorygi,
|
||||
Steam,
|
||||
]
|
||||
|
||||
# Don't change this, it should automatically generate __all__
|
||||
|
|
45
royalpack/tables/steam.py
Normal file
45
royalpack/tables/steam.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, backref
|
||||
from sqlalchemy.ext.declarative import declared_attr
|
||||
|
||||
|
||||
class Steam:
|
||||
__tablename__ = "steam"
|
||||
|
||||
@declared_attr
|
||||
def user_id(self):
|
||||
return Column(Integer, ForeignKey("users.uid"))
|
||||
|
||||
@declared_attr
|
||||
def user(self):
|
||||
return relationship("User", backref=backref("steam"))
|
||||
|
||||
@declared_attr
|
||||
def steam_id(self):
|
||||
return Column(BigInteger, primary_key=True)
|
||||
|
||||
@declared_attr
|
||||
def persona_name(self):
|
||||
return Column(String)
|
||||
|
||||
@declared_attr
|
||||
def profile_url(self):
|
||||
return Column(String)
|
||||
|
||||
@declared_attr
|
||||
def avatar(self):
|
||||
return Column(String)
|
||||
|
||||
@declared_attr
|
||||
def primary_clan_id(self):
|
||||
return Column(BigInteger)
|
||||
|
||||
@declared_attr
|
||||
def account_creation_date(self):
|
||||
return Column(DateTime)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Steam account {self.steam_id} of {self.user}>"
|
||||
|
||||
def __str__(self):
|
||||
return f"steam:{self.steam_id}"
|
Loading…
Reference in a new issue