diff --git a/CHANGELOG.md b/CHANGELOG.md index e99aa97..34443c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [2021.30.1] - 2022-07-30 +### Changed +- We have OCR again! `/update image:` to use it + ## [2021.30.1] - 2022-07-25 ### Changed - Fix leaderboards not loading if a server has no icon @@ -178,7 +182,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - `[p]progress (mention)` - Settings commands -[Unreleased]: https://github.com/TrainerDex/ DiscordBot/compare/v2022.30.0...develop +[Unreleased]: https://github.com/TrainerDex/ DiscordBot/compare/v2022.30.2...develop +[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2022.30.1...v2022.30.2 +[2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2022.30.0...v2022.30.1 [2022.30.0]: https://github.com/TrainerDex/DiscordBot/compare/v2021.43.0...v2022.30.0 [2021.43.0]: https://github.com/TrainerDex/DiscordBot/compare/v2020.48.0...v2021.43.0 [2020.48.0]: https://github.com/TrainerDex/DiscordBot/compare/v2020.40.2...v2020.48.0 diff --git a/Pipfile b/Pipfile index d1b7c54..728af6a 100644 --- a/Pipfile +++ b/Pipfile @@ -7,7 +7,6 @@ name = "pypi" humanize = "*" python-dateutil = "*" trainerdex = "==3.7" -PogoOCR = "==0.4.0b2" py-cord = ">=2.0.0" aiostream = "*" motor = ">=3.0,<3.1" diff --git a/Pipfile.lock b/Pipfile.lock index b239f43..34386e6 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "c885e89d75158941a29f68cd348913da4ce10a0619a661df1ff6cb8738bf33d4" + "sha256": "9cefa9e7c6f4e33c429ffbc2c75b5fc1cb029b16924590b35aabbbfc2afc0edc" }, "pipfile-spec": 6, "requires": { @@ -119,35 +119,11 @@ }, "attrs": { "hashes": [ - "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4", - "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd" + "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6", + "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==21.4.0" - }, - "babel": { - "hashes": [ - "sha256:7614553711ee97490f732126dc077f8d0ae084ebc6a96e23db1482afabdb2c51", - "sha256:ff56f4892c1c4bf0d814575ea23471c230d544203c7748e8c68f0089478d48eb" - ], - "markers": "python_version >= '3.6'", - "version": "==2.10.3" - }, - "cachetools": { - "hashes": [ - "sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757", - "sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db" - ], - "markers": "python_version ~= '3.7'", - "version": "==5.2.0" - }, - "certifi": { - "hashes": [ - "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d", - "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412" - ], - "markers": "python_version >= '3.6'", - "version": "==2022.6.15" + "markers": "python_version >= '3.5'", + "version": "==22.1.0" }, "charset-normalizer": { "hashes": [ @@ -157,19 +133,6 @@ "markers": "python_version >= '3.6'", "version": "==2.1.0" }, - "colormath": { - "hashes": [ - "sha256:3d4605af344527da0e4f9f504fad7ddbebda35322c566a6c72e28edb1ff31217" - ], - "version": "==3.0.0" - }, - "colour": { - "hashes": [ - "sha256:33f6db9d564fadc16e59921a56999b79571160ce09916303d35346dddc17978c", - "sha256:af20120fefd2afede8b001fbef2ea9da70ad7d49fafdb6489025dae8745c3aee" - ], - "version": "==0.1.5" - }, "frozenlist": { "hashes": [ "sha256:006d3595e7d4108a12025ddf415ae0f6c9e736e726a5db0183326fd191b14c5e", @@ -235,99 +198,6 @@ "markers": "python_version >= '3.7'", "version": "==1.3.0" }, - "google-api-core": { - "extras": [ - "grpc" - ], - "hashes": [ - "sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc", - "sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50" - ], - "markers": "python_version >= '3.6'", - "version": "==2.8.2" - }, - "google-auth": { - "hashes": [ - "sha256:14292fa3429f2bb1e99862554cde1ee730d6840ebae067814d3d15d8549c0888", - "sha256:5a7eed0cb0e3a83989fad0b59fe1329dfc8c479543039cd6fd1e01e9adf39475" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==2.9.1" - }, - "google-cloud-vision": { - "hashes": [ - "sha256:2ce19fbf3eb5170e90347f379457bc4f02376bbd9f1cb79314572a33d40bdd06", - "sha256:a1d76d14eb2bdf7033a4a42ebeabe57de70bea9bc87014703460bbb9e9a29a78" - ], - "markers": "python_version >= '3.7'", - "version": "==2.8.0" - }, - "googleapis-common-protos": { - "hashes": [ - "sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394", - "sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417" - ], - "markers": "python_version >= '3.7'", - "version": "==1.56.4" - }, - "grpcio": { - "hashes": [ - "sha256:0425b5577be202d0a4024536bbccb1b052c47e0766096e6c3a5789ddfd5f400d", - "sha256:06c0739dff9e723bca28ec22301f3711d85c2e652d1c8ae938aa0f7ad632ef9a", - "sha256:08307dc5a6ac4da03146d6c00f62319e0665b01c6ffe805cfcaa955c17253f9c", - "sha256:090dfa19f41efcbe760ae59b34da4304d4be9a59960c9682b7eab7e0b6748a79", - "sha256:0a24b50810aae90c74bbd901c3f175b9645802d2fbf03eadaf418ddee4c26668", - "sha256:0cd44d78f302ff67f11a8c49b786c7ccbed2cfef6f4fd7bb0c3dc9255415f8f7", - "sha256:0d8a7f3eb6f290189f48223a5f4464c99619a9de34200ce80d5092fb268323d2", - "sha256:14d2bc74218986e5edf5527e870b0969d63601911994ebf0dce96288548cf0ef", - "sha256:1bb9afa85e797a646bfcd785309e869e80a375c959b11a17c9680abebacc0cb0", - "sha256:1ec63bbd09586e5cda1bdc832ae6975d2526d04433a764a1cc866caa399e50d4", - "sha256:2061dbe41e43b0a5e1fd423e8a7fb3a0cf11d69ce22d0fac21f1a8c704640b12", - "sha256:324e363bad4d89a8ec7124013371f268d43afd0ac0fdeec1b21c1a101eb7dafb", - "sha256:35dfd981b03a3ec842671d1694fe437ee9f7b9e6a02792157a2793b0eba4f478", - "sha256:43857d06b2473b640467467f8f553319b5e819e54be14c86324dad83a0547818", - "sha256:4706c78b0c183dca815bbb4ef3e8dd2136ccc8d1699f62c585e75e211ad388f6", - "sha256:4d9ad7122f60157454f74a850d1337ba135146cef6fb7956d78c7194d52db0fe", - "sha256:544da3458d1d249bb8aed5504adf3e194a931e212017934bf7bfa774dad37fb3", - "sha256:55782a31ec539f15b34ee56f19131fe1430f38a4be022eb30c85e0b0dcf57f11", - "sha256:55cd8b13c5ef22003889f599b8f2930836c6f71cd7cf3fc0196633813dc4f928", - "sha256:5dbba95fab9b35957b4977b8904fc1fa56b302f9051eff4d7716ebb0c087f801", - "sha256:5f57b9b61c22537623a5577bf5f2f970dc4e50fac5391090114c6eb3ab5a129f", - "sha256:64e097dd08bb408afeeaee9a56f75311c9ca5b27b8b0278279dc8eef85fa1051", - "sha256:664a270d3eac68183ad049665b0f4d0262ec387d5c08c0108dbcfe5b351a8b4d", - "sha256:668350ea02af018ca945bd629754d47126b366d981ab88e0369b53bc781ffb14", - "sha256:67cd275a651532d28620eef677b97164a5438c5afcfd44b15e8992afa9eb598c", - "sha256:68b5e47fcca8481f36ef444842801928e60e30a5b3852c9f4a95f2582d10dcb2", - "sha256:7191ffc8bcf8a630c547287ab103e1fdf72b2e0c119e634d8a36055c1d988ad0", - "sha256:815089435d0f113719eabf105832e4c4fa1726b39ae3fb2ca7861752b0f70570", - "sha256:8dbef03853a0dbe457417c5469cb0f9d5bf47401b49d50c7dad3c495663b699b", - "sha256:91cd292373e85a52c897fa5b4768c895e20a7dc3423449c64f0f96388dd1812e", - "sha256:9298d6f2a81f132f72a7e79cbc90a511fffacc75045c2b10050bb87b86c8353d", - "sha256:96cff5a2081db82fb710db6a19dd8f904bdebb927727aaf4d9c427984b79a4c1", - "sha256:9e63e0619a5627edb7a5eb3e9568b9f97e604856ba228cc1d8a9f83ce3d0466e", - "sha256:a278d02272214ec33f046864a24b5f5aab7f60f855de38c525e5b4ef61ec5b48", - "sha256:a6b2432ac2353c80a56d9015dfc5c4af60245c719628d4193ecd75ddf9cd248c", - "sha256:b821403907e865e8377af3eee62f0cb233ea2369ba0fcdce9505ca5bfaf4eeb3", - "sha256:b88bec3f94a16411a1e0336eb69f335f58229e45d4082b12d8e554cedea97586", - "sha256:bfdb8af4801d1c31a18d54b37f4e49bb268d1f485ecf47f70e78d56e04ff37a7", - "sha256:c79996ae64dc4d8730782dff0d1daacc8ce7d4c2ba9cef83b6f469f73c0655ce", - "sha256:cc34d182c4fd64b6ff8304a606b95e814e4f8ed4b245b6d6cc9607690e3ef201", - "sha256:d0d481ff55ea6cc49dab2c8276597bd4f1a84a8745fedb4bc23e12e9fb9d0e45", - "sha256:e9723784cf264697024778dcf4b7542c851fe14b14681d6268fb984a53f76df1", - "sha256:f4508e8abd67ebcccd0fbde6e2b1917ba5d153f3f20c1de385abd8722545e05f", - "sha256:f515782b168a4ec6ea241add845ccfebe187fc7b09adf892b3ad9e2592c60af1", - "sha256:f89de64d9eb3478b188859214752db50c91a749479011abd99e248550371375f", - "sha256:fcd5d932842df503eb0bf60f9cc35e6fe732b51f499e78b45234e0be41b0018d" - ], - "version": "==1.47.0" - }, - "grpcio-status": { - "hashes": [ - "sha256:2154fdb8aad20452488712be6879657b508115ca06139fde8897ea8e9bc79367", - "sha256:c9ce3213e84c6fd8801c31aca3ea4a6b3453eaa40b93a6c0a23ea8999808fa00" - ], - "version": "==1.47.0" - }, "humanize": { "hashes": [ "sha256:2bc1fdd831cd00557d3010abdd84d3e41b4a96703a3eaf6c24ee290b26b75a44", @@ -417,114 +287,6 @@ "markers": "python_version >= '3.7'", "version": "==6.0.2" }, - "networkx": { - "hashes": [ - "sha256:15a7b81a360791c458c55a417418ea136c13378cfdc06a2dcdc12bd2f9cf09c1", - "sha256:a762f4b385692d9c3a6f2912d058d76d29a827deaedf9e63ed14d397b8030687" - ], - "markers": "python_version >= '3.8'", - "version": "==2.8.5" - }, - "numpy": { - "hashes": [ - "sha256:1408c3527a74a0209c781ac82bde2182b0f0bf54dea6e6a363fe0cc4488a7ce7", - "sha256:173f28921b15d341afadf6c3898a34f20a0569e4ad5435297ba262ee8941e77b", - "sha256:1865fdf51446839ca3fffaab172461f2b781163f6f395f1aed256b1ddc253622", - "sha256:3119daed207e9410eaf57dcf9591fdc68045f60483d94956bee0bfdcba790953", - "sha256:35590b9c33c0f1c9732b3231bb6a72d1e4f77872390c47d50a615686ae7ed3fd", - "sha256:37e5ebebb0eb54c5b4a9b04e6f3018e16b8ef257d26c8945925ba8105008e645", - "sha256:37ece2bd095e9781a7156852e43d18044fd0d742934833335599c583618181b9", - "sha256:3ab67966c8d45d55a2bdf40701536af6443763907086c0a6d1232688e27e5447", - "sha256:47f10ab202fe4d8495ff484b5561c65dd59177949ca07975663f4494f7269e3e", - "sha256:55df0f7483b822855af67e38fb3a526e787adf189383b4934305565d71c4b148", - "sha256:5d732d17b8a9061540a10fda5bfeabca5785700ab5469a5e9b93aca5e2d3a5fb", - "sha256:68b69f52e6545af010b76516f5daaef6173e73353e3295c5cb9f96c35d755641", - "sha256:7e8229f3687cdadba2c4faef39204feb51ef7c1a9b669247d49a24f3e2e1617c", - "sha256:8002574a6b46ac3b5739a003b5233376aeac5163e5dcd43dd7ad062f3e186129", - "sha256:876f60de09734fbcb4e27a97c9a286b51284df1326b1ac5f1bf0ad3678236b22", - "sha256:9ce242162015b7e88092dccd0e854548c0926b75c7924a3495e02c6067aba1f5", - "sha256:a35c4e64dfca659fe4d0f1421fc0f05b8ed1ca8c46fb73d9e5a7f175f85696bb", - "sha256:aeba539285dcf0a1ba755945865ec61240ede5432df41d6e29fab305f4384db2", - "sha256:b15c3f1ed08df4980e02cc79ee058b788a3d0bef2fb3c9ca90bb8cbd5b8a3a04", - "sha256:c2f91f88230042a130ceb1b496932aa717dcbd665350beb821534c5c7e15881c", - "sha256:d748ef349bfef2e1194b59da37ed5a29c19ea8d7e6342019921ba2ba4fd8b624", - "sha256:e0d7447679ae9a7124385ccf0ea990bb85bb869cef217e2ea6c844b6a6855073" - ], - "markers": "python_version >= '3.8'", - "version": "==1.23.1" - }, - "pillow": { - "hashes": [ - "sha256:0030fdbd926fb85844b8b92e2f9449ba89607231d3dd597a21ae72dc7fe26927", - "sha256:030e3460861488e249731c3e7ab59b07c7853838ff3b8e16aac9561bb345da14", - "sha256:0ed2c4ef2451de908c90436d6e8092e13a43992f1860275b4d8082667fbb2ffc", - "sha256:136659638f61a251e8ed3b331fc6ccd124590eeff539de57c5f80ef3a9594e58", - "sha256:13b725463f32df1bfeacbf3dd197fb358ae8ebcd8c5548faa75126ea425ccb60", - "sha256:1536ad017a9f789430fb6b8be8bf99d2f214c76502becc196c6f2d9a75b01b76", - "sha256:15928f824870535c85dbf949c09d6ae7d3d6ac2d6efec80f3227f73eefba741c", - "sha256:17d4cafe22f050b46d983b71c707162d63d796a1235cdf8b9d7a112e97b15bac", - "sha256:1802f34298f5ba11d55e5bb09c31997dc0c6aed919658dfdf0198a2fe75d5490", - "sha256:1cc1d2451e8a3b4bfdb9caf745b58e6c7a77d2e469159b0d527a4554d73694d1", - "sha256:1fd6f5e3c0e4697fa7eb45b6e93996299f3feee73a3175fa451f49a74d092b9f", - "sha256:254164c57bab4b459f14c64e93df11eff5ded575192c294a0c49270f22c5d93d", - "sha256:2ad0d4df0f5ef2247e27fc790d5c9b5a0af8ade9ba340db4a73bb1a4a3e5fb4f", - "sha256:2c58b24e3a63efd22554c676d81b0e57f80e0a7d3a5874a7e14ce90ec40d3069", - "sha256:2d33a11f601213dcd5718109c09a52c2a1c893e7461f0be2d6febc2879ec2402", - "sha256:337a74fd2f291c607d220c793a8135273c4c2ab001b03e601c36766005f36885", - "sha256:37ff6b522a26d0538b753f0b4e8e164fdada12db6c6f00f62145d732d8a3152e", - "sha256:3d1f14f5f691f55e1b47f824ca4fdcb4b19b4323fe43cc7bb105988cad7496be", - "sha256:408673ed75594933714482501fe97e055a42996087eeca7e5d06e33218d05aa8", - "sha256:4134d3f1ba5f15027ff5c04296f13328fecd46921424084516bdb1b2548e66ff", - "sha256:4ad2f835e0ad81d1689f1b7e3fbac7b01bb8777d5a985c8962bedee0cc6d43da", - "sha256:50dff9cc21826d2977ef2d2a205504034e3a4563ca6f5db739b0d1026658e004", - "sha256:510cef4a3f401c246cfd8227b300828715dd055463cdca6176c2e4036df8bd4f", - "sha256:5aed7dde98403cd91d86a1115c78d8145c83078e864c1de1064f52e6feb61b20", - "sha256:69bd1a15d7ba3694631e00df8de65a8cb031911ca11f44929c97fe05eb9b6c1d", - "sha256:6bf088c1ce160f50ea40764f825ec9b72ed9da25346216b91361eef8ad1b8f8c", - "sha256:6e8c66f70fb539301e064f6478d7453e820d8a2c631da948a23384865cd95544", - "sha256:727dd1389bc5cb9827cbd1f9d40d2c2a1a0c9b32dd2261db522d22a604a6eec9", - "sha256:74a04183e6e64930b667d321524e3c5361094bb4af9083db5c301db64cd341f3", - "sha256:75e636fd3e0fb872693f23ccb8a5ff2cd578801251f3a4f6854c6a5d437d3c04", - "sha256:7761afe0126d046974a01e030ae7529ed0ca6a196de3ec6937c11df0df1bc91c", - "sha256:7888310f6214f19ab2b6df90f3f06afa3df7ef7355fc025e78a3044737fab1f5", - "sha256:7b0554af24df2bf96618dac71ddada02420f946be943b181108cac55a7a2dcd4", - "sha256:7c7b502bc34f6e32ba022b4a209638f9e097d7a9098104ae420eb8186217ebbb", - "sha256:808add66ea764ed97d44dda1ac4f2cfec4c1867d9efb16a33d158be79f32b8a4", - "sha256:831e648102c82f152e14c1a0938689dbb22480c548c8d4b8b248b3e50967b88c", - "sha256:93689632949aff41199090eff5474f3990b6823404e45d66a5d44304e9cdc467", - "sha256:96b5e6874431df16aee0c1ba237574cb6dff1dcb173798faa6a9d8b399a05d0e", - "sha256:9a54614049a18a2d6fe156e68e188da02a046a4a93cf24f373bffd977e943421", - "sha256:a138441e95562b3c078746a22f8fca8ff1c22c014f856278bdbdd89ca36cff1b", - "sha256:a647c0d4478b995c5e54615a2e5360ccedd2f85e70ab57fbe817ca613d5e63b8", - "sha256:a9c9bc489f8ab30906d7a85afac4b4944a572a7432e00698a7239f44a44e6efb", - "sha256:ad2277b185ebce47a63f4dc6302e30f05762b688f8dc3de55dbae4651872cdf3", - "sha256:b6d5e92df2b77665e07ddb2e4dbd6d644b78e4c0d2e9272a852627cdba0d75cf", - "sha256:bc431b065722a5ad1dfb4df354fb9333b7a582a5ee39a90e6ffff688d72f27a1", - "sha256:bdd0de2d64688ecae88dd8935012c4a72681e5df632af903a1dca8c5e7aa871a", - "sha256:c79698d4cd9318d9481d89a77e2d3fcaeff5486be641e60a4b49f3d2ecca4e28", - "sha256:cb6259196a589123d755380b65127ddc60f4c64b21fc3bb46ce3a6ea663659b0", - "sha256:d5b87da55a08acb586bad5c3aa3b86505f559b84f39035b233d5bf844b0834b1", - "sha256:dcd7b9c7139dc8258d164b55696ecd16c04607f1cc33ba7af86613881ffe4ac8", - "sha256:dfe4c1fedfde4e2fbc009d5ad420647f7730d719786388b7de0999bf32c0d9fd", - "sha256:ea98f633d45f7e815db648fd7ff0f19e328302ac36427343e4432c84432e7ff4", - "sha256:ec52c351b35ca269cb1f8069d610fc45c5bd38c3e91f9ab4cbbf0aebc136d9c8", - "sha256:eef7592281f7c174d3d6cbfbb7ee5984a671fcd77e3fc78e973d492e9bf0eb3f", - "sha256:f07f1f00e22b231dd3d9b9208692042e29792d6bd4f6639415d2f23158a80013", - "sha256:f3fac744f9b540148fa7715a435d2283b71f68bfb6d4aae24482a890aed18b59", - "sha256:fa768eff5f9f958270b081bb33581b4b569faabf8774726b283edb06617101dc", - "sha256:fac2d65901fb0fdf20363fbd345c01958a742f2dc62a8dd4495af66e3ff502a4" - ], - "markers": "python_version >= '3.7'", - "version": "==9.2.0" - }, - "pogoocr": { - "hashes": [ - "sha256:7ede77f5c5fb9f08f9d773f3d1ce40dc52b3010369a1381d197559380489d81c", - "sha256:9df7da2cff1975168d5d2c8e31af7dbdb15255e2ff9a67fc4eef9929bc1ecfd8" - ], - "index": "pypi", - "version": "==0.4.0b2" - }, "prettytable": { "hashes": [ "sha256:118eb54fd2794049b810893653b20952349df6d3bc1764e7facd8a18064fa9b0", @@ -540,44 +302,6 @@ "index": "pypi", "version": "==2.3" }, - "proto-plus": { - "hashes": [ - "sha256:449b4537e83f4776bd69051c4d776db8ffe3f9d0641f1e87b06c116eb94c90e9", - "sha256:c6c43c3fcfc360fdab46b47e2e9e805ff56e13169f9f2e45caf88b6b593215ab" - ], - "markers": "python_version >= '3.6'", - "version": "==1.20.6" - }, - "protobuf": { - "hashes": [ - "sha256:06059eb6953ff01e56a25cd02cca1a9649a75a7e65397b5b9b4e929ed71d10cf", - "sha256:097c5d8a9808302fb0da7e20edf0b8d4703274d140fd25c5edabddcde43e081f", - "sha256:284f86a6207c897542d7e956eb243a36bb8f9564c1742b253462386e96c6b78f", - "sha256:32ca378605b41fd180dfe4e14d3226386d8d1b002ab31c969c366549e66a2bb7", - "sha256:3cc797c9d15d7689ed507b165cd05913acb992d78b379f6014e013f9ecb20996", - "sha256:62f1b5c4cd6c5402b4e2d63804ba49a327e0c386c99b1675c8a0fefda23b2067", - "sha256:69ccfdf3657ba59569c64295b7d51325f91af586f8d5793b734260dfe2e94e2c", - "sha256:6f50601512a3d23625d8a85b1638d914a0970f17920ff39cec63aaef80a93fb7", - "sha256:7403941f6d0992d40161aa8bb23e12575637008a5a02283a930addc0508982f9", - "sha256:755f3aee41354ae395e104d62119cb223339a8f3276a0cd009ffabfcdd46bb0c", - "sha256:77053d28427a29987ca9caf7b72ccafee011257561259faba8dd308fda9a8739", - "sha256:7e371f10abe57cee5021797126c93479f59fccc9693dafd6bd5633ab67808a91", - "sha256:9016d01c91e8e625141d24ec1b20fed584703e527d28512aa8c8707f105a683c", - "sha256:9be73ad47579abc26c12024239d3540e6b765182a91dbc88e23658ab71767153", - "sha256:adc31566d027f45efe3f44eeb5b1f329da43891634d61c75a5944e9be6dd42c9", - "sha256:adfc6cf69c7f8c50fd24c793964eef18f0ac321315439d94945820612849c388", - "sha256:af0ebadc74e281a517141daad9d0f2c5d93ab78e9d455113719a45a49da9db4e", - "sha256:cb29edb9eab15742d791e1025dd7b6a8f6fcb53802ad2f6e3adcb102051063ab", - "sha256:cd68be2559e2a3b84f517fb029ee611546f7812b1fdd0aa2ecc9bc6ec0e4fdde", - "sha256:cdee09140e1cd184ba9324ec1df410e7147242b94b5f8b0c64fc89e38a8ba531", - "sha256:db977c4ca738dd9ce508557d4fce0f5aebd105e158c725beec86feb1f6bc20d8", - "sha256:dd5789b2948ca702c17027c84c2accb552fc30f4622a98ab5c51fcfe8c50d3e7", - "sha256:e250a42f15bf9d5b09fe1b293bdba2801cd520a9f5ea2d7fb7536d4441811d20", - "sha256:ff8d8fa42675249bb456f5db06c00de6c2f4c27a065955917b28c4f15978b9c3" - ], - "markers": "python_version >= '3.7'", - "version": "==3.20.1" - }, "py-cord": { "hashes": [ "sha256:045bf5409a657f5125cb6d66e82715e188b179af1851de37ccc0685837646336", @@ -586,42 +310,6 @@ "index": "pypi", "version": "==2.0.0" }, - "pyasn1": { - "hashes": [ - "sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359", - "sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576", - "sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf", - "sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7", - "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d", - "sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00", - "sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8", - "sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86", - "sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12", - "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776", - "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba", - "sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2", - "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3" - ], - "version": "==0.4.8" - }, - "pyasn1-modules": { - "hashes": [ - "sha256:0845a5582f6a02bb3e1bde9ecfc4bfcae6ec3210dd270522fee602365430c3f8", - "sha256:0fe1b68d1e486a1ed5473f1302bd991c1611d319bba158e98b106ff86e1d7199", - "sha256:15b7c67fabc7fc240d87fb9aabf999cf82311a6d6fb2c70d00d3d0604878c811", - "sha256:426edb7a5e8879f1ec54a1864f16b882c2837bfd06eee62f2c982315ee2473ed", - "sha256:65cebbaffc913f4fe9e4808735c95ea22d7a7775646ab690518c056784bc21b4", - "sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e", - "sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74", - "sha256:a99324196732f53093a84c4369c996713eb8c89d360a496b599fb1a9c47fc3eb", - "sha256:b80486a6c77252ea3a3e9b1e360bc9cf28eaac41263d173c032581ad2f20fe45", - "sha256:c29a5e5cc7a3f05926aff34e097e84f8589cd790ce0ed41b67aed6857b26aafd", - "sha256:cbac4bc38d117f2a49aeedec4407d23e8866ea4ac27ff2cf7fb3e5b570df19e0", - "sha256:f39edd8c4ecaa4556e989147ebf219227e2cd2e8a43c7e7fcb1f1c18c5fd6a3d", - "sha256:fe0644d9ab041506b62782e92b06b8c68cca799e1a9636ec398675459e031405" - ], - "version": "==0.2.8" - }, "pymongo": { "hashes": [ "sha256:01721da74558f2f64a9f162ee063df403ed656b7d84229268d8e4ae99cfba59c", @@ -702,29 +390,6 @@ "index": "pypi", "version": "==2.8.2" }, - "pytz": { - "hashes": [ - "sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7", - "sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c" - ], - "version": "==2022.1" - }, - "requests": { - "hashes": [ - "sha256:7c5599b102feddaa661c826c56ab4fee28bfd17f5abca1ebbe3e7f19d7c97983", - "sha256:8fefa2a1a1365bf5520aac41836fbee479da67864514bdb821f31ce07ce65349" - ], - "markers": "python_version >= '3.7' and python_version < '4'", - "version": "==2.28.1" - }, - "rsa": { - "hashes": [ - "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7", - "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21" - ], - "markers": "python_version >= '3.6'", - "version": "==4.9" - }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", @@ -741,14 +406,6 @@ "index": "pypi", "version": "==3.7" }, - "urllib3": { - "hashes": [ - "sha256:8298d6d56d39be0e3bc13c1c97d133f9b45d797169a0e11cdd0e0489d786f7ec", - "sha256:879ba4d1e89654d9769ce13121e0f94310ea32e8d2f8cf587b77c08bbcdb30d6" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4'", - "version": "==1.26.10" - }, "wcwidth": { "hashes": [ "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784", diff --git a/README.md b/README.md index f02b963..bfd5c92 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Support Server](https://img.shields.io/discord/364313717720219651.svg?color=7289da&label=TrainerDex&logo=discord&style=flat)](https://discord.gg/bDPnJ2) [![Translation status](https://hosted.weblate.org/widgets/trainerdex/-/discord-bot/svg-badge.svg)](https://hosted.weblate.org/engage/trainerdex/) -[![Maintenance](https://img.shields.io/static/v1?label=Maintained?&message=bug+fixes+only&color=orange&style=flat)](#) +[![Maintenance](https://img.shields.io/static/v1?label=Maintained?&message=Yes!&color=green&style=flat)](#) [![wakatime](https://wakatime.com/badge/github/TrainerDex/DiscordBot.svg?style=flat)](https://wakatime.com/badge/github/TrainerDex/DiscordBot) [![Visit our Sponsor](https://img.shields.io/static/v1?label=Sponsored+by&message=Wynaut+Wyandotte&color=7289da&logo=discord&style=flat)](https://discord.gg/jJKVAPw4Pw) [![Sponsor us](https://img.shields.io/static/v1?label=Patreon&message=TrainerDexApp&color=ff424d&style=flat)](https://www.patreon.com/TrainerDexApp) diff --git a/docs/getting_started.md b/docs/getting_started.md index a73d9e6..89370b4 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -5,7 +5,25 @@ This section will be updated when the bot goes public, very soon. ## Configuring the bot -Generally, you will need `Manage Server` or `Administrator` permissions to use any of the config commands on the bot. These permissions were picked to match the permissions Discord requires to install the bot. + +### Setting up the mod roles +First things first, you will want to set which roles the bot should consider a mod. This has two halves to it. The bot, and Discord. First we will configure Discord. + +#### Discord Config + 1) Go to the [Integrations](https://user-images.githubusercontent.com/11667059/181601459-d14db6d5-c756-4a47-8448-c34d3d2c988e.png) +tab within your Server Settings. + 2) Scroll down and select the TrainerDex integration. This is where you can control who can see and trigger commands within the Discord UI. + 3) Select `/approve` and tap the No ❎ option for `@everyone`. Add a role override for the role(s) you assign your mods and slect the green check mark ✔️. ([Example](https://user-images.githubusercontent.com/11667059/181602221-29e17512-4cc8-4019-84bc-599700a97324.png)) + 4) Rince and repeat for `/server-config`. + +Now we've told Discord to show these commands to the mod roles. By default, it will only show to users with **Administrator** or **Manage Server** permissions otherwise. + +#### Bot Config +Unfortunately, Discord has been known to screw up and just show the command to everybody anyway. So I was forced to add in some validation in the actual command. So we're going to have to set that up too: + - Run the following command: `/server-config mod-roles action: Add role role: x` for each of your mod role(s) ([Example](https://user-images.githubusercontent.com/11667059/181603960-9317fb4b-8688-47fc-8fba-8582171d7c8c.png)) + - If you don't run this command, the bot will most likely ignore calls to priviledged commands (`/approve` and `/server-config`) + +## Command list The following commands exist: - `/server-config mod-roles` - Provides functionality to set which roles on your server are considered mods. The bot will consider somebody a mod if they have `Manage Server`, `Administrator` permissions, or one of the roles in this list. @@ -21,8 +39,6 @@ The following commands exist: - `/server-config tl40-role` - Set a role you use to restrict level 40+ players. Currently not used as the levels system is being reworked. - - - `/approve` - the command to grant a user access to your server, and creates a TrainerDex profile for them. This takes several params, including team, username and Total XP. - Notes on Username: You **must** set this to their In-Game Trainer Name. Please ensure `i` is `i`, `L` is `L` etc, although we understand these can get mixed up. When in doubt, ask the user what it is. - Notes on Total XP: This is the trainers all time Total XP, **not** the XP progress through their current level. diff --git a/trainerdex_discord_bot/__init__.py b/trainerdex_discord_bot/__init__.py index 75055f6..338cf32 100644 --- a/trainerdex_discord_bot/__init__.py +++ b/trainerdex_discord_bot/__init__.py @@ -9,6 +9,6 @@ """ -VERSION = (2022, 30, 1, "final", 0) +VERSION = (2022, 30, 2, "final", 0) __version__ = f"{VERSION[0]}.{VERSION[1]}.{VERSION[2]}-{VERSION[3]}.{VERSION[4]}" diff --git a/trainerdex_discord_bot/__main__.py b/trainerdex_discord_bot/__main__.py index 8c0e67d..7268b30 100644 --- a/trainerdex_discord_bot/__main__.py +++ b/trainerdex_discord_bot/__main__.py @@ -64,7 +64,14 @@ async def on_ready() -> None: }, ) private_logger.info("Public: %(public)s", {"public": app_info.bot_public}) - logger.info("Bot loaded at {time}.".format(time=datetime.datetime.utcnow().isoformat())) + logger.info( + "Bot loaded at {time}.".format( + time=chat_formatting.format_time( + datetime.datetime.now(), + chat_formatting.TimeVerbosity.LONG_DATETIME, + ) + ) + ) @bot.event async def on_application_command_error(ctx: ApplicationContext, exception: Exception) -> None: diff --git a/trainerdex_discord_bot/cogs/post.py b/trainerdex_discord_bot/cogs/post.py index 61c1422..c3361b9 100644 --- a/trainerdex_discord_bot/cogs/post.py +++ b/trainerdex_discord_bot/cogs/post.py @@ -1,6 +1,6 @@ import datetime from decimal import Decimal -from typing import TYPE_CHECKING, Optional +from typing import TYPE_CHECKING, Dict, Optional from discord import ( ApplicationContext, @@ -11,54 +11,36 @@ slash_command, ) from discord.utils import snowflake_time -from google.oauth2 import service_account -from PogoOCR import OCRClient, Screenshot, ScreenshotClass -from PogoOCR.providers import Providers from trainerdex_discord_bot.cogs.interface import Cog -from trainerdex_discord_bot.config import TokenDocuments from trainerdex_discord_bot.constants import STAT_MAP from trainerdex_discord_bot.embeds import ProfileCard +from trainerdex_discord_bot.new_ocr_client import NewOCRClient from trainerdex_discord_bot.utils import chat_formatting from trainerdex_discord_bot.utils.converters import get_trainer, get_trainer_from_user from trainerdex_discord_bot.utils.general import send from trainerdex_discord_bot.utils.validators import validate_trainer_nickname if TYPE_CHECKING: - from PogoOCR.images.actitvity_view import ActivityViewData from trainerdex.trainer import Trainer from trainerdex.update import Update class PostCog(Cog): - async def __post_init__(self) -> None: - await super().__post_init__() - - self.ocr = None - if google_token := await self.config.get_token(TokenDocuments.GOOGLE.value): - credentials: service_account.Credentials = ( - service_account.Credentials.from_service_account_info(google_token) - ) - self.ocr = OCRClient(credentials=credentials, provider=Providers.GOOGLE) - - @property - def ocr_initialized(self) -> bool: - return isinstance(self.ocr, OCRClient) - @slash_command( name="update", description="Update your stats with an image, optionally a few other stats are included.", options=[ - Option(int, name="total_xp", description="Total XP", required=False), - Option(int, name="pokestops_visited", description="Backpacker", required=False), - Option(int, name="capture_total", description="Collector", required=False), - Option(float, name="travel_km", description="Jogger", required=False), Option( Attachment, name="image", - description="Image for OCR, when it's working again.", + description="Image for OCR", required=False, ), + Option(int, name="total_xp", description="Total XP", required=False), + Option(int, name="pokestops_visited", description="Backpacker", required=False), + Option(int, name="capture_total", description="Collector", required=False), + Option(float, name="travel_km", description="Jogger", required=False), Option(int, name="gym_gold", description="Gold Gym Badges", required=False), Option(int, name="unique_pokestops", description="Sightseer", required=False), Option(int, name="legendary_battle_won", description="Battle Legend", required=False), @@ -84,11 +66,11 @@ def ocr_initialized(self) -> bool: async def update_via_slash_command( self, ctx: ApplicationContext, + image: Attachment | None = None, total_xp: int | None = None, pokestops_visited: int | None = None, capture_total: int | None = None, travel_km: float | None = None, - image: Attachment | None = None, gym_gold: int | None = None, unique_pokestops: int | None = None, legendary_battle_won: int | None = None, @@ -166,16 +148,9 @@ async def update_via_slash_command( return data_from_ocr = {} - if self.ocr_initialized and image is not None: + if image is not None: try: - screenshot = await Screenshot.from_url( - image.url, - klass=ScreenshotClass.ACTIVITY_VIEW, - asyncronous=True, - ) - - request = self.ocr.open_request(screenshot) - result: ActivityViewData = self.ocr.process_ocr(request) + result: Dict[str, float] = await NewOCRClient.request_activitiy_view_scan(image) except Exception: if not kwargs: await send( @@ -194,10 +169,10 @@ async def update_via_slash_command( ) else: data_from_ocr: dict[str, Decimal | int | None] = { - "travel_km": result.travel_km, - "capture_total": result.capture_total, - "pokestops_visited": result.pokestops_visited, - "total_xp": result.total_xp, + "travel_km": result.get("Distance"), + "capture_total": result.get("Pokémon"), + "pokestops_visited": result.get("PokéStops"), + "total_xp": result.get("Total"), } stats_to_update = kwargs | data_from_ocr diff --git a/trainerdex_discord_bot/new_ocr_client.py b/trainerdex_discord_bot/new_ocr_client.py new file mode 100644 index 0000000..96e9bed --- /dev/null +++ b/trainerdex_discord_bot/new_ocr_client.py @@ -0,0 +1,20 @@ +import os +from typing import ClassVar, Dict + +import aiohttp +from discord import Attachment + + +class NewOCRClient: + + HOST: ClassVar[str] = os.environ.get("TRAINERDEX_HOST", "https://trainerdex.app") + + @classmethod + async def request_activitiy_view_scan(cls, image: Attachment) -> Dict[str, float]: + async with aiohttp.ClientSession() as session: + headers = { + "Content-Disposition": f"attachment; filename={image.filename}" + } + async with session.put(f'{cls.HOST}/api/ocr/activity-view/', data=await image.read(), headers=headers) as resp: + resp.raise_for_status() + return await resp.json() \ No newline at end of file diff --git a/trainerdex_discord_bot/utils/chat_formatting.py b/trainerdex_discord_bot/utils/chat_formatting.py index 81afc01..b9a943d 100644 --- a/trainerdex_discord_bot/utils/chat_formatting.py +++ b/trainerdex_discord_bot/utils/chat_formatting.py @@ -1,3 +1,6 @@ +import calendar +from datetime import datetime +from enum import Enum import textwrap from decimal import ROUND_HALF_UP, Decimal from io import BytesIO @@ -430,3 +433,18 @@ def format_numbers(number: int | float | Decimal, ndigits: int = 2) -> str: if not float(number).is_integer(): number = Decimal(number).quantize(Decimal(f"0.{'0' * ndigits}"), rounding=ROUND_HALF_UP) return humanize.intcomma(number) + +class TimeVerbosity(Enum): + """Enum for the verbosity of the :func:`format_time` function.""" + SHORT_DATE = "d" + LONG_DATE = "D" + SHORT_TIME = "t" + LONG_TIME = "T" + SHORT_DATETIME = "f" + LONG_DATETIME = "F" + DELTA = "R" + + +def format_time(dt: datetime, verbosity: TimeVerbosity = TimeVerbosity.LONG_DATETIME) -> str: + """Formats a datetime in a way Discord loves it""" + return f""