Compare commits
4 Commits
c8b0f170e3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
0caaf3c88a
|
|||
|
bbd41a697d
|
|||
|
04ec236c58
|
|||
|
310ee0d6eb
|
2
index.js
2
index.js
@@ -121,7 +121,7 @@ function connectLndhub () {
|
|||||||
if (connected) {
|
if (connected) {
|
||||||
console.log("Connected to Lndhub");
|
console.log("Connected to Lndhub");
|
||||||
// automatically refresh auth token once a day
|
// automatically refresh auth token once a day
|
||||||
setInterval(lndhub.reauth, 86400000);
|
setInterval(() => lndhub.reauth(), 86400000);
|
||||||
} else {
|
} else {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default class Lndhub {
|
|||||||
async handleErroredRequest (result, retryFunction, args=[]) {
|
async handleErroredRequest (result, retryFunction, args=[]) {
|
||||||
console.warn('API request failed:', result.message);
|
console.warn('API request failed:', result.message);
|
||||||
if (result.code === 1) {
|
if (result.code === 1) {
|
||||||
return this.reauth().bind(this).then(connected => {
|
return this.reauth().then(connected => {
|
||||||
if (connected) {
|
if (connected) {
|
||||||
console.warn('Lndhub reconnected, trying again...');
|
console.warn('Lndhub reconnected, trying again...');
|
||||||
return this[retryFunction](...args);
|
return this[retryFunction](...args);
|
||||||
@@ -68,8 +68,7 @@ export default class Lndhub {
|
|||||||
let data = await this.callEndpoint('post', '/v2/invoices', payload);
|
let data = await this.callEndpoint('post', '/v2/invoices', payload);
|
||||||
|
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
return this.handleErroredRequest(data, 'createInvoice',Array.from(arguments))
|
return this.handleErroredRequest(data, 'createInvoice', Array.from(arguments));
|
||||||
.bind(this);
|
|
||||||
} else {
|
} else {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -79,8 +78,7 @@ export default class Lndhub {
|
|||||||
const data = await this.callEndpoint('get', `/v2/invoices/${paymentHash}`);
|
const data = await this.callEndpoint('get', `/v2/invoices/${paymentHash}`);
|
||||||
|
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
return this.handleErroredRequest(data, 'getInvoice', Array.from(arguments))
|
return this.handleErroredRequest(data, 'getInvoice', Array.from(arguments));
|
||||||
.bind(this);
|
|
||||||
} else {
|
} else {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "xmpp-lightning-antispam",
|
"name": "xmpp-lightning-antispam",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "xmpp-lightning-antispam",
|
"name": "xmpp-lightning-antispam",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xmpp/client": "^0.13.1",
|
"@xmpp/client": "^0.13.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xmpp-lightning-antispam",
|
"name": "xmpp-lightning-antispam",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"description": "A bot for moderated XMPP channels, offering voice for Lightning donations",
|
"description": "A bot for moderated XMPP channels, offering voice for Lightning donations",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
Reference in New Issue
Block a user