Skip to content

Commit

Permalink
chore(misc): tiny improvements (jef#233)
Browse files Browse the repository at this point in the history
Co-authored-by: Jef LeCompte <[email protected]>
  • Loading branch information
serg06 and jef authored Sep 23, 2020
1 parent 22fd22f commit 8466f9f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The purpose of this bot is to get an Nvidia card. It tries multiple things to do

> :point_right: You may get false positives from time to time, so I apologize for that. The library currently waits for all calls to be completed before parsing, but sometimes this can have unknown behavior. Patience is a virtue :)
| | **Adorama** | **Amazon** | **ASUS** | **EVGA** | **Best Buy** | **B&H** | **Micro Center** | **Newegg** | **Nvidia** | **Office Depot** | **Zotac** |
| | **Adorama** | **Amazon** | **ASUS** | **B&H** | **Best Buy** | **EVGA** | **Micro Center** | **Newegg** | **Nvidia** | **Office Depot** | **Zotac** |
|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
| **3070**| | | | | | | | | | | |
| **3080** | `` | `` | `` | `` | `` | `` | `` | `` | `` | `` | `` |
Expand Down Expand Up @@ -112,9 +112,9 @@ Here is a list of variables that you can use to customize your newly copied `.en
| Amazon | `amazon`|
| Amazon (CA) | `amazon-ca`|
| ASUS | `asus` |
| B&H | `bandh`|
| Best Buy | `bestbuy`|
| Best Buy (CA) | `bestbuy-ca`|
| B&H | `bandh`|
| EVGA | `evga`|
| EVGA (EU) | `evga-eu`|
| Micro Center | `microcenter`|
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ puppeteer.use(adBlocker);
* Starts the bot.
*/
async function main() {
if (Stores.length === 0) {
Logger.error('No stores selected.');
return;
}

const args: string[] = [];

// Skip Chromium Linux Sandbox
Expand Down
8 changes: 8 additions & 0 deletions src/notification/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import fs from 'fs';
import playerLib from 'play-sound';

const notificationSound = Config.notifications.playSound;

Logger.info('Searching for sound player...');
const player = playerLib();
if (player.player === null) {
Logger.warn('No sound player found.');
} else {
const playerName: string = player.player;
Logger.info(`Sound player found: ${playerName}`);
}

export function playSound() {
// Check if file exists
Expand Down
11 changes: 10 additions & 1 deletion src/store/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {BestBuyCa} from './bestbuy-ca';
import {Config} from '../../config';
import {Evga} from './evga';
import {EvgaEu} from './evga-eu';
import {Logger} from '../../logger';
import {MicroCenter} from './microcenter';
import {NewEgg} from './newegg';
import {NewEggCa} from './newegg-ca';
Expand Down Expand Up @@ -38,9 +39,17 @@ const masterList = new Map([
const list = new Map();

for (const name of Config.store.stores) {
list.set(name, masterList.get(name));
if (masterList.has(name)) {
list.set(name, masterList.get(name));
} else {
const logString = `No store named ${name}, skipping.`;
Logger.warn(logString);
}
}

const logString = `Selected stores: ${Array.from(list.keys()).join(', ')}`;
Logger.info(logString);

export const Stores = Array.from(list.values()) as Store[];

export * from './store';

0 comments on commit 8466f9f

Please sign in to comment.