From e5b35ad64ffc64fccf0f2443d837b511b89b3c9b Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 19 Jun 2019 22:18:43 +0100 Subject: Update CHANGELOG.md --- CHANGELOG.md | 4 +++- modules/upc.py | 52 ---------------------------------------------------- 2 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 modules/upc.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e381ab84..1b08b61e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,17 +17,19 @@ Changed: - `auto-title`, `auto-youtube`, `auto-imgur` etc now work in `/me` - Move truncation logic from `SentLine` to `ParsedLine` - Move `!help` logic to it's own file and rework it to be more user friendly -- Get `"city, state, country"` from geocoding in location.py, use in weather.py +- Get `"city, state, country"` from geocoding in `location.py`, use in `weather.py` Fixed: - `KeyError` when sts `port` key not present - lxml wasn't in requirements.txt but it should have been - Any CRITICAL in read/write thread now kills the main thread too - `Database.ChannelSettings.find` invalid SQL +- `birthday.py`'s year no longer .lstrip("0")ed Removed: - `!set`/`!channelset`/`!serverset`/`!botset` (replaced with `!config`) - `bytes-read-per-second` and `bytes-written-per-second` from stats endpoint +- `upc.py` # 2019-06-09 - BitBot v1.9.2 diff --git a/modules/upc.py b/modules/upc.py deleted file mode 100644 index 08c02056..00000000 --- a/modules/upc.py +++ /dev/null @@ -1,52 +0,0 @@ -#--depends-on commands - -from src import ModuleManager, utils - -UPCITEMDB_URL = "https://api.upcitemdb.com/prod/trial/lookup" - -class Module(ModuleManager.BaseModule): - _name = "UPC" - - @utils.hook("received.command.upc|ean|gtin", min_args=1) - def upc(self, event): - """ - :help: Look up a product by UPC, EAN or GTIN - :usage: - """ - arg_len = len(event["args_split"][0]) - if not arg_len == 12 and not arg_len == 13: - raise utils.EventError("Invalid UPC/EAN/GTIN provided") - - page = utils.http.request(UPCITEMDB_URL, - get_params={"upc": event["args_split"][0]}, - json=True) - if page: - if not len(page.data["items"]): - raise utils.EventError("UPC/EAN not found") - item = page.data["items"][0] - - brand = item.get("brand", None) - brand = "" if not brand else "%s - " % brand - title = item["title"] - description = item.get("description", None) - description = " " if not description else ": %s " % description - - weight = item.get("weight", None) - weight = weight or "unknown" - size = item.get("dimension", None) - size = size or "unknown" - - currency = item.get("currency", None) - lowest_price = item.get("lowest_recorded_price", None) - highest_price = item.get("highest_recorded_price", None) - - pricing = "price: unknown" - if lowest_price and highest_price and currency: - pricing = "price: %s to %s %s" % ( - lowest_price, highest_price, currency) - - event["stdout"].write("%s%s%s(weight: %s" - ", size: %s, price: %s)" % ( - brand, title, description, weight, size, pricing)) - else: - raise utils.EventsResultsError() -- cgit v1.3.1-10-gc9f91