-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory Commands fail to load folders unless cache explicitly ignored #65
Comments
inv.populate() returns a promise, are you |
Yes, absolutely. I ended up just dealing with it myself / work around it by looping over the results of a different call, The only issue is it rapidly gets stale and cannot be relied upon for many things you'd use inventory for. |
That's weird, because i'm using exactly that in some of my bots. Can you provide a sample script demonstrating the failure? |
One of the really ideal scenarios for me was figuring out what items were "New" within the inventory. I'll have to re-write a script for this, since my code with the workaround has been done for months now |
Sorry to be a pain, but I really need it to be able to diagnose this issue, since I have code which depends on this feature. I need to figure out what's different. |
The initial use-case where it returns All you have to do is echo out; const inv = bot.clientCommands.inventory.getInventoryRoot();
await inv.populate(false);
console.log('folders', inv.folders.map((folder) => folder.name)); Then do any operation on the inventory. Rename folders, delete folders... It does not matter. Run the above code again, and you'll get the same result as before, with the modified data not present and the old data still there From my understanding, the |
Actually I've replicated it, sorry it took me a minute; Just do this; const inv = bot.clientCommands.inventory.getInventoryRoot();
await inv.populate();
console.log('folders', inv.folders.map((folder) => folder.name)); If |
|
|
The Inventory Cache does not cache folders, at all
Currently the saveCache method saves;
While inversely, the loadCache method only looks at
this.items
However, folders are under
this.folders
and when loading the inventory viaYou end up with a
inv.folders
of[]
instead of the array of folders you'd expect, so you're basically forced to not use the cache at all if you want your inventory to be usable in any wayThe text was updated successfully, but these errors were encountered: