mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 05:17:35 +00:00
chore: add banner, only show sound if enabled
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
[FAQ](#FAQ) | [Issues](https://github.com/jef/nvidia-snatcher/issues) | [Wiki](https://github.com/jef/nvidia-snatcher/wiki)
|
||||
|
||||

|
||||
|
||||
The purpose of this bot is to get an Nvidia card. It tries multiple things to do that.
|
||||
|
||||
- Currently, `nvidia-snatcher` is not capable of purchasing a card for you
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
@@ -3,26 +3,28 @@ import {Logger} from '../logger';
|
||||
import fs from 'fs';
|
||||
import playerLib from 'play-sound';
|
||||
|
||||
const notificationSound = Config.notifications.playSound;
|
||||
let player: any;
|
||||
|
||||
const player = playerLib();
|
||||
if (Config.notifications.playSound) {
|
||||
player = playerLib();
|
||||
|
||||
if (player.player === null) {
|
||||
Logger.warn('✖ couldn\'t find sound player');
|
||||
} else {
|
||||
const playerName: string = player.player;
|
||||
Logger.info(`✔ sound player found: ${playerName}`);
|
||||
if (player.player === null) {
|
||||
Logger.warn('✖ couldn\'t find sound player');
|
||||
} else {
|
||||
const playerName: string = player.player;
|
||||
Logger.info(`✔ sound player found: ${playerName}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function playSound() {
|
||||
if (player.player !== null) {
|
||||
fs.access(notificationSound, fs.constants.F_OK, error => {
|
||||
fs.access(Config.notifications.playSound, fs.constants.F_OK, error => {
|
||||
if (error) {
|
||||
Logger.error(`✖ error opening sound file: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
player.play(notificationSound, (error: Error) => {
|
||||
player.play(Config.notifications.playSound, (error: Error) => {
|
||||
if (error) {
|
||||
Logger.error('✖ couldn\'t play sound', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user