Update CHANGELOG.md
This commit is contained in:
parent
1d16009317
commit
e5b35ad64f
2 changed files with 3 additions and 53 deletions
|
@ -17,17 +17,19 @@ Changed:
|
||||||
- `auto-title`, `auto-youtube`, `auto-imgur` etc now work in `/me`
|
- `auto-title`, `auto-youtube`, `auto-imgur` etc now work in `/me`
|
||||||
- Move truncation logic from `SentLine` to `ParsedLine`
|
- Move truncation logic from `SentLine` to `ParsedLine`
|
||||||
- Move `!help` logic to it's own file and rework it to be more user friendly
|
- 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:
|
Fixed:
|
||||||
- `KeyError` when sts `port` key not present
|
- `KeyError` when sts `port` key not present
|
||||||
- lxml wasn't in requirements.txt but it should have been
|
- lxml wasn't in requirements.txt but it should have been
|
||||||
- Any CRITICAL in read/write thread now kills the main thread too
|
- Any CRITICAL in read/write thread now kills the main thread too
|
||||||
- `Database.ChannelSettings.find` invalid SQL
|
- `Database.ChannelSettings.find` invalid SQL
|
||||||
|
- `birthday.py`'s year no longer .lstrip("0")ed
|
||||||
|
|
||||||
Removed:
|
Removed:
|
||||||
- `!set`/`!channelset`/`!serverset`/`!botset` (replaced with `!config`)
|
- `!set`/`!channelset`/`!serverset`/`!botset` (replaced with `!config`)
|
||||||
- `bytes-read-per-second` and `bytes-written-per-second` from stats endpoint
|
- `bytes-read-per-second` and `bytes-written-per-second` from stats endpoint
|
||||||
|
- `upc.py`
|
||||||
|
|
||||||
# 2019-06-09 - BitBot v1.9.2
|
# 2019-06-09 - BitBot v1.9.2
|
||||||
|
|
||||||
|
|
|
@ -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: <UPC|EAN|GTIN>
|
|
||||||
"""
|
|
||||||
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()
|
|
Loading…
Reference in a new issue