Skip to content

Commit

Permalink
show Time rem only when status is PENDING (lnp2pBot#530)
Browse files Browse the repository at this point in the history
* show Time rem only when status is PENDING 

Co-authored-by: Aki <[email protected]>

* Code cleaned

Co-authored-by: Aki <[email protected]>

* formatting

* change let to const

---------

Co-authored-by: Aki <[email protected]>
  • Loading branch information
johan-naizu and Aki-works authored May 19, 2024
1 parent 04319f9 commit 3612c14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bot/modules/orders/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ exports.listOrdersResponse = async (orders, i18n) => {

if (typeof order.amount !== 'undefined') amount = order.amount;
const timeToExpire = getTimeToExpirationOrder(order, i18n);
return [
const details = [
[''].join(''),
['`Id `: ', '`', order.id, '`'].join(''),
['`Status `: ', '`', status, '`'].join(''),
['`Time rem`: ', '`', timeToExpire, '`'].join(''),
['`Sats amt`: ', '`', amount, '`'].join(''),
['`Fiat amt`: ', '`', fiatAmount, '`'].join(''),
['`Fiat `: ', '`', order.fiat_code, '`'].join(''),
['`Channel `: ', '`', sanitizeMD(channel), '`'].join(''),
['`_________________________________`'].join(''),
].join('\n');
];
if (status === 'PENDING') {
details.splice(3, 0, ['`Time rem`: ', '`', timeToExpire, '`'].join(''));
}
return details.join('\n');
});
const lines = await Promise.all(tasks);
const body = lines.join('\n');
Expand Down

0 comments on commit 3612c14

Please sign in to comment.