Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions bot/ordersActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,13 @@ const buildDescription = (
}: BuildDescriptionArguments,
) => {
try {
const action = type === 'sell' ? i18n.t('selling') : i18n.t('buying');
const hashtag = `#${type.toUpperCase()}${fiatCode}\n`;
const paymentAction =
type === 'sell' ? i18n.t('receive_payment') : i18n.t('pay');
const trades = user.trades_completed;
const volume = numberFormat(fiatCode, user.volume_traded);
const totalRating = user.total_rating;
const totalReviews = user.total_reviews;
const username = user.show_username
? `@${user.username} ` + i18n.t('is') + ` `
: ``;
const volumeTraded = user.show_volume_traded
? i18n.t('trading_volume', { volume }) + `\n`
: ``;
Expand All @@ -245,10 +241,8 @@ const buildDescription = (
if (currency)
currencyString = `${fiatAmountString} ${currency.code} ${currency.emoji}`;

let amountText = `${numberFormat(fiatCode, amount)} `;
let tasaText = '';
if (priceFromAPI) {
amountText = '';
tasaText =
i18n.t('rate') + `: ${process.env.FIAT_RATE_NAME} ${priceMarginText}\n`;
} else {
Expand All @@ -266,8 +260,9 @@ const buildDescription = (

const ageInDays = getUserAge(user);

let description =
`${username}${action} ${amountText}` + i18n.t('sats') + `\n`;
const firstLine = getOrderTitleMessage(user, type, i18n);

let description: string = `${firstLine}\n`;
description += i18n.t('for') + ` ${currencyString}\n`;
description += `${paymentAction} ` + i18n.t('by') + ` ${paymentMethod}\n`;
description += i18n.t('has_successful_trades', { trades }) + `\n`;
Expand All @@ -283,6 +278,24 @@ const buildDescription = (
}
};

const getOrderTitleMessage = (
user: UserDocument,
type: string,
i18n: I18nContext,
) => {
const isSell = type === 'sell';

// Guard Clause: The user DOES want to show their name, we resolve and leave.
if (user.show_username) {
return isSell
? i18n.t('showusername_selling_sats', { username: user.username })
: i18n.t('showusername_buying_sats', { username: user.username });
}

// The user DOES NOT want to show their name.
return isSell ? i18n.t('selling_sats') : i18n.t('buying_sats');
};

const getOrder = async (
ctx: MainContext,
user: UserDocument,
Expand Down
6 changes: 4 additions & 2 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,11 @@ pending_payment_failed_to_admin: |
Die Bezahlung der LN-Rechnung für den Auftrag ${orderId} des Benutzers @${username} ist fehlgeschlagen.

Zahlungsversuche: ${attempts}
selling: Verkaufe
buying: Kaufe
selling_sats: Verkaufe Sats
buying_sats: Kaufe Sats
receive_payment: Zahlung erhalten
showusername_buying_sats: '@${username} kauft Sats'
showusername_selling_sats: '@${username} verkauft Sats'
pay: Bezahlen
is: ist
trading_volume: 'Handelsvolumen: ${Volumen} Sats'
Expand Down
6 changes: 4 additions & 2 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,10 @@ pending_payment_failed_to_admin: |
Payment of the invoice for the Buy order ${orderId} of user @${username} has failed.

Payment attempts: ${attempts}
selling: Selling
buying: Buying
selling_sats: Selling sats
buying_sats: Buying sats
showusername_selling_sats: '@${username} is selling sats'
showusername_buying_sats: '@${username} is buying sats'
receive_payment: Receive payment
pay: Pay
is: is
Expand Down
6 changes: 4 additions & 2 deletions locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,10 @@ pending_payment_failed_to_admin: |
El pago a la invoice de la compra Id: ${orderId} del usuario @${username} ha fallado!

Intento de pago: ${attempts}
selling: Vendiendo
buying: Comprando
selling_sats: Vendiendo sats
buying_sats: Comprando sats
showusername_buying_sats: '@${username} está comprando sats'
showusername_selling_sats: '@${username} está vendiendo sats'
receive_payment: Recibo pago
pay: Pago
is: está
Expand Down
15 changes: 8 additions & 7 deletions locales/fa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,17 @@ pending_payment_failed: |
گاهی اوقات کاربران شبکه لایتنینگ به دلیل ناکافی بودن ظرفیت دریافت کیف پولشان یا اتصال ناپایدار گره به شبکه، نمی‌توانند پرداخت‌ها را دریافت کنند. شاید بهتر باشد با استفاده از کیف پول دیگری یک صورتحساب ایجاد کنید.
pending_payment_failed_to_admin: |
پرداخت صورتحساب سفارش خرید کاربر @${username} با شناسه ${orderId} شکست خورد.

تعداد تلاش‌های پرداخت: ${attempts}
selling: فروختن
buying: خریدن
receive_payment: دریافت پرداخت
selling_sats: فروش ساتوشی
buying_sats: خرید ساتوشی
receive_payment: دریافت وجه
pay: پرداخت
is: هست
trading_volume: 'حجم معاملات: ${volume} ساتوشی'
satoshis: ساتوشی
by: با
trading_volume: 'حجم معاملات: ${volume} sat'
showusername_buying_sats: '@${username} در حال خرید ساتوشی است'
showusername_selling_sats: '@${username} در حال فروش ساتوشی است'
satoshis: ساتوشی‌ها
by: توسط
rate: نرخ
has_successful_trades: 'دارای ${trades} معامله موفق'
user_age: 'از ربات به مدت ${days} روز استفاده کرده است.'
Expand Down
6 changes: 4 additions & 2 deletions locales/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,11 @@ pending_payment_failed_to_admin: |
Le paiement de la facture pour l'offre d'achat ${orderId} de l'utilisateur @${username} a échoué.

Tentatives de paiement : ${attempts}
selling: Vente
buying: Achat
selling_sats: Vente de sats
buying_sats: Achat de sats
receive_payment: Réception du paiement
showusername_buying_sats: "@${username} achète des sats"
showusername_selling_sats: "@${username} vent des sats"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix French conjugation in username sell sentence.
Line 441 currently says vent; it should be vend for singular subject (@${username}).

✏️ Proposed fix
-showusername_selling_sats: "@${username} vent des sats"
+showusername_selling_sats: "@${username} vend des sats"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
showusername_selling_sats: "@${username} vent des sats"
showusername_selling_sats: "@${username} vend des sats"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/fr.yaml` at line 441, The French translation key
showusername_selling_sats uses the incorrect verb form "vent"; update its value
to use the singular conjugation "vend" so the line reads
showusername_selling_sats: "@${username} vend des sats" to match the singular
subject interpolation @${username}.

pay: Payer
is: est
trading_volume: 'Volume de transactions : ${volume} sats'
Expand Down
6 changes: 4 additions & 2 deletions locales/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,14 @@ pending_payment_failed_to_admin: |
Il pagamento della invoice per l'ordine di acquisto ${orderId} dell'utente @${username} è fallito.

Payment attempts: ${attempts}
selling: Vendita
buying: Acquisto
selling_sats: Vendita sats
buying_sats: Acquisto sats
receive_payment: Ricezione del pagamento
pay: Paga
is: è
trading_volume: 'Volume scambio: ${volume} sats'
showusername_buying_sats: '@${username} sta comprando sats'
showusername_selling_sats: '@${username} sta vendendo sats'
satoshis: satoshi
by: da
rate: Valutazione
Expand Down
6 changes: 4 additions & 2 deletions locales/ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,14 @@ pending_payment_failed_to_admin: |

결제 시도 횟수: ${attempts}

selling: 팝니다
buying: 삽니다
selling_sats: sats 판매
buying_sats: sats 구매
receive_payment: 입금
pay: 결제
is: is
trading_volume: '거래량: ${volume} sats'
showusername_buying_sats: '@${username} 님이 sats를 구매합니다'
showusername_selling_sats: '@${username} 님이 sats를 판매합니다'
satoshis: 사토시
by: 방법 -
rate: 환율
Expand Down
6 changes: 4 additions & 2 deletions locales/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,12 @@ pending_payment_failed_to_admin: |
Pagamento da fatura para o pedido de compra ${orderId} de usuário @${username} falhou.

Tentativas de pagamento: ${attempts}
selling: Vendendo
buying: Comprando
selling_sats: Vendendo sats
buying_sats: Comprando sats
receive_payment: Receber pagamento
pay: Pagar
showusername_buying_sats: '@${username} está comprando sats'
showusername_selling_sats: '@${username} está vendendo sats'
is: é
trading_volume: 'Volume de negócios: ${volume} sats'
satoshis: satoshis
Expand Down
6 changes: 4 additions & 2 deletions locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,11 @@ pending_payment_failed_to_admin: |
Платеж по счету-фактуре на покупку с идентификатором ${orderId} пользователя @${username} не выполнен!

Попытка оплаты: ${attempts}
selling: Продаю
buying: Покупаю
selling_sats: Продажа сат
buying_sats: Покупка сат
receive_payment: Расчет
showusername_buying_sats: '@${username} покупает саты'
showusername_selling_sats: '@${username} продает саты'
pay: Расчет
is: Я
trading_volume: 'Обьем торгов: ${volume} сат'
Expand Down
6 changes: 4 additions & 2 deletions locales/uk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,14 @@ pending_payment_failed_to_admin: |
Платіж за рахунком-фактурою на покупку з ідентифікатором ${orderId} користувача @${username} не виконаний!

Спроб оплати: ${attempts}
selling: Продаю
buying: Купую
selling_sats: Продаж сатоші
buying_sats: Купівля сатоші
receive_payment: Розрахунок
pay: Оплата
is: є
trading_volume: 'Обсяг торгів: ${volume} сат'
showusername_buying_sats: '@${username} купує сатоші'
showusername_selling_sats: '@${username} продає сатоші'
satoshis: сатоші
by: за допомогою
rate: Kурс
Expand Down
Loading