Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/amiami/amiami-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ class Item {
return Boolean(this.#item.stock);
}

/**
* Whether an item is unavailable in any regions.
*
* This currently only works for items requested in English.
*/
regionLocked() {
// This should work for all current known cases:
// - "This product cannot be shipped to the following area: [...]"
// - "This product cannot be shipped to the following areas: [...]"
// - "This product cannot be shipped to some areas."
return this.remarks.includes("This product cannot be shipped to");
}

/**
* @returns {number} the total discount rate.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/amiami/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AmiAmiApiPreview {
.setDescription(`
**Price**: ¥${Math.trunc(priceJpy)} / $${priceUsd.toFixed(2)} ${discountRate > 0 ? `(${discountRate}% off)` : ""}
**Status**: ${item.saleStatus} ${!item.orderable() ? "(Out of stock)" : ""}
${item.remarks ? "⚠️ This item may not be available in all regions." : ""}
${item.regionLocked() ? "⚠️ This item may not be available in all regions." : ""}
`.trim())
.setTitle(item.name)
.setImage(item.image)
Expand Down