diff options
Diffstat (limited to 'modules/upc.py')
| -rw-r--r-- | modules/upc.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/upc.py b/modules/upc.py index 0e47801f..8da063f5 100644 --- a/modules/upc.py +++ b/modules/upc.py @@ -1,16 +1,15 @@ -from src import Utils +from src import ModuleManager, Utils UPCITEMDB_URL = "https://api.upcitemdb.com/prod/trial/lookup" -class Module(object): +class Module(ModuleManager.BaseModule): _name = "UPC" - def __init__(self, bot, events, exports): - self.bot = bot - events.on("received.command").on("upc", "ean", "gtin").hook( - self.upc, min_args=1, usage="<UPC|EAN>", - help="Look up a product by UPC or EAN") + @Utils.hook("received.command.upc|ean|gtin", min_args=1, usage="<UPC|EAN>") def upc(self, event): + """ + Look up a product by UPC, EAN or GTIN + """ arg_len = len(event["args_split"][0]) if not arg_len == 12 and not arg_len == 13: event["stderr"].write("Invalid UPC/EAN provided") |
