Closed Lukemul6 closed 4 years ago
You can change the lastPrice
stored in the database for the item to be something higher than what it actually is, and then the next time it checks it'll compare the two prices and hopefully report the actual current price.
To do this, you can run UPDATE watchlist SET lastPrice=[something higher than the current actual price] WHERE link LIKE "%product_code%"
in the MySQL terminal, replacing the word "product_code" with the asin of one of your currently watched items, eg. "%B07V4GCFP9%".
Thanks for the response. I got this error trying to do that
mysql> UPDATE watchlist SET lastPrice=1000 "%B07VGRJDFY%";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"%B07VGRJDFY%"' at line 1
You didn't write the full command, you forgot that it needs to be WHERE link LIKE "%product_code%"
not just "%product_code%"
Oh wait. I got it. I think I misinterpreted what this bot does. I thought it was a stock monitor.
It does also monitor items that go in/out of stock
Oh! haha. I got the embeds for the price changes. No way I can test for in/out stock?
I think it should work if you set lastPrice=0
instead of some high number and it'll tell you it's in stock when it checks next
Ayyy that works amazing! Thank you so much!
No worries! Glad it's working :)
@spikegd How often does the bot check for restocks/price changes?
@MDM98 Every minute, plus a 2 second buffer per item to avoid sending too many requests to Amazon at once.
EDIT: You probably shouldn't change it, by the way, since it heightens the risk that Amazon starts asking for captchas
@spikegd Yeah I deleted that comment about changing it cuz I didn't realize the bot is checking every minute. I was thinking it was taking way longer to check. I still can't get the test to work though. You mentioned that changing lastPrice in the watchlist to something way higher than the item's price will make an alert happen, but it didn't work.
@MDM98 Well I don't know what to tell you. When you add an item to the watchlist, does it respond with a message that says what's been added? If you run $watchlist
does it show that there are any items in it?
@spikegd Yeah all that works fine. I just want the bot to send me an alert saying "This item is now in stock" or "This item dropped to this price" after I add my links to the watchlist.
@MDM98 Yeah, it should do that, I just wanted to make sure that it worked properly before that in your server. What SQL command are you running?
I’ve had it running over night it’s working amazingly. Just make sure you follow the instructions. I put UPDATE watchlist SET lastPrice=1000 It changed the price of all 5 items to 1000 then after a minute or so it adjusted to the correct price and sends the notification.
@spikegd @Lukemul6 Yeah I did exactly what you did UPDATE watchlist SET lastPrice=1000 And the item I'm testing it with is this book in my watchlist: https://www.amazon.com//dp/0316187747/ But I'm not getting any price drop or in stock alerts on my discord server.
Have you checked in MySQL to see if the watchlists lastPrice gets updated to 1000?
@MDM98 Can you try testing it with a regular Amazon item (like https://www.amazon.com/dp/B07SJFW9T3/), the way Amazon formats the markup for books (which is how the bot gets information on an item) is different. If it works with a normal item then I'll look into fixing the book support
Yeah I ran the command in MySQL Workbench and the lastPrice column is updated to 1000 in my watchlist table.
@spikegd Yay it works! The Switch is actually what I was going to use this for lol. So if one the neons comes in stock from Amazon, not a 3rd party from this link: https://www.amazon.com/dp/B07VGRJDFY/ will I get an alert saying it's in stock?
@MDM98 Theoretically, yes 😄
I got it all working, the commands work great. I add some items to my watchlist and they do appear in the !watchlist embed. I added stuff thats already in stock just to see what the monitor would do but it does nothing?
Any way for me to actually test it?