Skip to content
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

feat(discord): dynamic currency symbol #1328

Merged
merged 8 commits into from
Dec 12, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/__test__/notification-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const link: Link = {
};

const store: Store = {
currency: '',
labels: {
inStock: {
container: 'test:container',
Expand Down
7 changes: 6 additions & 1 deletion src/notification/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export function sendDiscordMessage(link: Link, store: Store) {
.setTimestamp();

embed.addField('Store', store.name, true);
if (link.price) embed.addField('Price', `$${link.price}`, true);
if (link.price)
embed.addField(
'Price',
`${store.currency}${link.price}`,
true
);
embed.addField('Product Page', link.url);
if (link.cartUrl) embed.addField('Add to Cart', link.cartUrl);
embed.addField('Brand', link.brand, true);
Expand Down
4 changes: 2 additions & 2 deletions src/notification/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import {sendTwitchMessage} from './twitch';
export function sendNotification(link: Link, store: Store) {
// Priority
playSound();
sendDiscordMessage(link, store);
sendDesktopNotification(link, store);
sendEmail(link, store);
sendSms(link, store);
sendDesktopNotification(link, store);
// Non-priority
adjustPhilipsHueLights();
sendDiscordMessage(link, store);
sendMqttMessage(link, store);
sendPagerDutyNotification(link, store);
sendPushbulletNotification(link, store);
Expand Down
1 change: 1 addition & 0 deletions src/store/model/adorama.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Adorama: Store = {
currency: '$',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/alternate-nl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AlternateNL: Store = {
currency: '€',
labels: {
inStock: {
container: '.stockStatus',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/alternate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Alternate: Store = {
currency: '€',
labels: {
inStock: {
container: '.stockStatus',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-ca.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AmazonCa: Store = {
currency: '$',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-de-warehouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const AmazonDeWarehouse: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const AmazonDe: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const AmazonEs: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const AmazonFr: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const AmazonIt: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-nl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AmazonNl: Store = {
currency: '€',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon-uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {parseCard} from './helpers/card';

export const AmazonUk: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '£',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amazon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const Amazon: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '$',
labels: {
captcha: {
container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amd-ca.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AmdCa: Store = {
currency: '$',
labels: {
inStock: {
container: '.btn-shopping-cart',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amd-de.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AmdDe: Store = {
currency: '€',
labels: {
inStock: {
container: '.btn-shopping-cart',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amd-it.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AmdIt: Store = {
currency: '€',
labels: {
inStock: {
container: '.btn-shopping-cart',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/amd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Amd: Store = {
currency: '$',
labels: {
inStock: {
container: '.btn-shopping-cart',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/antonline.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AntOnline: Store = {
currency: '$',
labels: {
inStock: {
container: '.uk-button',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/argos.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Argos: Store = {
currency: '£',
labels: {
inStock: {
container: 'button[data-test="add-to-trolley-button-button"',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';
import {getProductLinksBuilder} from './helpers/card';

export const Aria: Store = {
currency: '£',
labels: {
inStock: {
container: '#addQuantity',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/arlt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Arlt: Store = {
currency: '€',
labels: {
inStock: {
container: '.articleDesc .shippingtext',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/asus-de.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const AsusDe: Store = {
currency: '€',
labels: {
inStock: {
container: '.buybox--button',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/asus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import fetch from 'node-fetch';

export const Asus: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '$',
labels: {
inStock: {
container: '#item_add_cart',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/awd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';
import {getProductLinksBuilder} from './helpers/card';

export const Awd: Store = {
currency: '£',
labels: {
inStock: {
container: '.vs-stock .ty-qty-in-stock',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/azerty.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Azerty: Store = {
currency: '€',
labels: {
inStock: {
container: '.orderdelay',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/bandh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const BAndH: Store = {
backoffStatusCodes: [403, 429],
currency: '$',
labels: {
inStock: {
container: 'div[data-selenium="addToCartSection"]',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/bestbuy-ca.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const BestBuyCa: Store = {
currency: '$',
labels: {
inStock: {
container: '.addToCartContainer_2uzan',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/bestbuy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const BestBuy: Store = {
currency: '$',
labels: {
inStock: {
container:
Expand Down
1 change: 1 addition & 0 deletions src/store/model/box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';
import {getProductLinksBuilder} from './helpers/card';

export const Box: Store = {
currency: '£',
labels: {
inStock: {
container: '#divBuyButton',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/canadacomputers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const CanadaComputers: Store = {
currency: '$',
labels: {
inStock: {
container: 'div[class="pi-prod-availability"]',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/caseking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const Caseking: Store = {
backoffStatusCodes: [403, 429],
currency: '€',
labels: {
inStock: {
container: '.delivery_container',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/ccl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {getProductLinksBuilder} from './helpers/card';

export const Ccl: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '£',
labels: {
inStock: {
container: '#pnlAddToBasket',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/comet.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Comet: Store = {
currency: '€',
labels: {
inStock: {
container: '.caption',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/computeruniverse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Computeruniverse: Store = {
currency: '€',
labels: {
inStock: {
container: '.availability',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/coolblue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Coolblue: Store = {
currency: '€',
labels: {
inStock: {
container: '.product-order',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/coolmod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Coolmod: Store = {
currency: '€',
labels: {
inStock: {
container: '.product-availability',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/corsair.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Corsair: Store = {
currency: '$',
labels: {
inStock: {
container: '.add_to_cart_form',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/currys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';
import {getProductLinksBuilder} from './helpers/card';

export const Currys: Store = {
currency: '£',
labels: {
inStock: {
container: '#product-actions button',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/cyberport.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Cyberport: Store = {
currency: '€',
labels: {
inStock: {
container: '.tooltipAvailabilityParent',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/ebgames.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const EbGames: Store = {
currency: '$',
labels: {
maxPrice: {
container: '.singleVariantText .prodPriceCont'
Expand Down
3 changes: 2 additions & 1 deletion src/store/model/ebuyer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import {Store} from './store';
import {getProductLinksBuilder} from './helpers/card';

export const Ebuyer: Store = {
currency: '£',
labels: {
inStock: {
container: '.purchase-info',
text: ['add to basket', 'in stock']
text: ['add to basket', 'in stock', 'pre-order']
},
maxPrice: {
container: '.purchase-info__price .price',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/elcorteingles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Store} from './store';

export const Elcorteingles: Store = {
backoffStatusCodes: [403, 429, 503],
currency: '€',
labels: {
// Captcha: {
// container: 'body',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/eprice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Eprice: Store = {
currency: '€',
labels: {
inStock: {
container: '.topSideDx',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/euronics-de.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const EuronicsDE: Store = {
currency: '€',
labels: {
inStock: {
container: '.buy-btn--cart-text',
Expand Down
1 change: 1 addition & 0 deletions src/store/model/euronics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Store} from './store';

export const Euronics: Store = {
currency: '€',
labels: {
inStock: {
container: '.purchaseButtonsWidth',
Expand Down