aboutsummaryrefslogtreecommitdiffstats
path: root/lib/payments.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/payments.js')
-rw-r--r--lib/payments.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/payments.js b/lib/payments.js
index b855e549..b17dfde6 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -181,12 +181,16 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
callWebhook(invoice, p);
if (user.hasprinter) {
- let fiat = parseFloat(((amount * p.rate) / 100000000).toFixed(2));
- let words = dollarsToWords(fiat);
let client = mqtt.connect("mqtt://ln.coinos.io", config.mqtt);
client.subscribe(username);
+ let connected;
+
+ if (user.hasspeaker) {
+ let fiat = parseFloat(((amount * p.rate) / 100000000).toFixed(2));
+ let words = dollarsToWords(fiat);
+
if (fiat === 0.02) {
words = "there is no second best";
client.publish(username, "easter");
@@ -205,7 +209,6 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
let raw = `/app/data/uploads/${p.id}-raw.mp3`;
let out = `/app/data/uploads/${p.id}.mp3`;
- let connected;
let mimic = spawn("/mimic", [
"-t",
words,
@@ -275,6 +278,7 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => {
client.publish(username, `end:${chunks.length}`);
});
});
+ }
client.on("connect", function() {
client.publish(