From 4608d533a116b4d24fe26c12eca41feb56b932ec Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 22 Oct 2020 19:17:50 -0400 Subject: [PATCH 1/2] Fix index error --- src/cogs/weeb.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cogs/weeb.py b/src/cogs/weeb.py index 50b46f2..f74b9c9 100644 --- a/src/cogs/weeb.py +++ b/src/cogs/weeb.py @@ -31,7 +31,10 @@ class Weeb(cmds.Cog): for item, url in urls.items(): browser.get(url) - status = browser.find_elements_by_css_selector('#addToCartText-product-template')[0].text + try: + status = browser.find_elements_by_css_selector('#addToCartText-product-template')[0].text + except IndexError: + status = 'SOLD OUT' if status != 'SOLD OUT': message += f'{item} is in stock at Switchmod!\n<{url}>\n' From f8407577c115713c5087965bc3ccd8cea7ecdf20 Mon Sep 17 00:00:00 2001 From: Myned Date: Thu, 22 Oct 2020 19:18:16 -0400 Subject: [PATCH 2/2] Add stop message and increase timer --- src/cogs/weeb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cogs/weeb.py b/src/cogs/weeb.py index f74b9c9..87e1ee6 100644 --- a/src/cogs/weeb.py +++ b/src/cogs/weeb.py @@ -75,8 +75,9 @@ class Weeb(cmds.Cog): browser.quit() self.weebing = False + print('STOPPED : weebing') - await asyncio.sleep(60) + await asyncio.sleep(120) except Exception as e: tb.print_exc()